[Pkg-javascript-commits] [node-entities] 60/63: test: added basic tests for `escape`

Wolfgang Borgert debacle at moszumanska.debian.org
Mon Sep 22 08:15:49 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository node-entities.

commit 320d0ece4e885c86c3954abdd4c79d06d058e6ed
Author: fb55 <me at feedic.com>
Date:   Sun Apr 13 22:45:47 2014 +0200

    test: added basic tests for `escape`
---
 test/test.js | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/test/test.js b/test/test.js
index 9c09fe9..8a8e945 100644
--- a/test/test.js
+++ b/test/test.js
@@ -140,6 +140,10 @@ describe("Astral entities", function(){
 		it("should encode " + astral[c], function(){
 			assert.equal(entities.encode(astral[c]), "&#x" + c + ";");
 		});
+
+		it("should escape " + astral[c], function(){
+			assert.equal(entities.escape(astral[c]), "&#x" + c + ";");
+		});
 	});
 
 	Object.keys(astralSpecial).forEach(function(c){
@@ -148,3 +152,12 @@ describe("Astral entities", function(){
 		});
 	});
 });
+
+describe("Escape", function(){
+	it("should always decode ASCII chars", function(){
+		for(var i = 0; i < 0x7F; i++){
+			var c = String.fromCharCode(i);
+			assert.equal(entities.decodeXML(entities.escape(c)), c);
+		}
+	});
+});

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-entities.git



More information about the Pkg-javascript-commits mailing list