[Pkg-javascript-commits] [node-entities] 42/63: updated tests
Wolfgang Borgert
debacle at moszumanska.debian.org
Mon Sep 22 08:15:47 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 9f0906ae0cbc4bcaa4874fe45a30bceff7890934
Author: fb55 <me at feedic.com>
Date: Mon Mar 17 20:27:35 2014 +0100
updated tests
---
test/test.js | 45 +++++++++++++++++++++------------------------
1 file changed, 21 insertions(+), 24 deletions(-)
diff --git a/test/test.js b/test/test.js
index af988b2..bac7cd9 100644
--- a/test/test.js
+++ b/test/test.js
@@ -7,13 +7,11 @@ describe("Encode->decode test", function(){
{
input: "asdf & ÿ ü '",
xml: "asdf & ÿ ü '",
- html4: "asdf & ÿ ü '",
- html5: "asdf & ÿ ü '"
+ html: "asdf & ÿ ü '"
}, {
input: "&",
xml: "&",
- html4: "&",
- html5: "&#38;"
+ html: "&#38;"
},
];
testcases.forEach(function(tc) {
@@ -34,20 +32,12 @@ describe("Encode->decode test", function(){
assert.equal(entities.decodeStrict(encodedXML), tc.input);
});
- var encodedHTML4 = entities.encodeHTML4(tc.input);
- it("should HTML4 encode " + tc.input, function(){
- assert.equal(encodedHTML4, tc.html4);
- });
- it("should HTML4 decode " + encodedHTML4, function(){
- assert.equal(entities.decodeHTML4(encodedHTML4), tc.input);
- });
-
var encodedHTML5 = entities.encodeHTML5(tc.input);
it("should HTML5 encode " + tc.input, function(){
- assert.equal(encodedHTML5, tc.html5);
+ assert.equal(encodedHTML5, tc.html);
});
it("should HTML5 decode " + encodedHTML5, function(){
- assert.equal(entities.decodeHTML5(encodedHTML5), tc.input);
+ assert.equal(entities.decodeHTML(encodedHTML5), tc.input);
});
});
});
@@ -71,15 +61,15 @@ describe("Decode test", function(){
assert.equal(entities.decodeXML(tc.input), tc.output);
});
it("should HTML4 decode " + tc.input, function(){
- assert.equal(entities.decodeHTML4(tc.input), tc.output);
+ assert.equal(entities.decodeHTML(tc.input), tc.output);
});
it("should HTML5 decode " + tc.input, function(){
- assert.equal(entities.decodeHTML5(tc.input), tc.output);
+ assert.equal(entities.decodeHTML(tc.input), tc.output);
});
});
});
-var levels = ["xml", "html4", "html5"];
+var levels = ["xml", "entities"];
describe("Documents", function(){
levels
@@ -90,7 +80,7 @@ describe("Documents", function(){
it(levels[i], function(){
Object.keys(doc).forEach(function(e){
for(var l = i; l < levels.length; l++){
- assert.equal(entities.decode("&" + e, l), doc[e]);
+ assert.equal(entities.decode("&" + e + ";", l), doc[e]);
}
});
});
@@ -99,12 +89,8 @@ describe("Documents", function(){
describe("Decode strict", function(){
it(levels[i], function(){
Object.keys(doc).forEach(function(e){
- if(e.substr(-1) !== ";"){
- assert.equal(entities.decodeStrict("&" + e, i), "&" + e);
- return;
- }
for(var l = i; l < levels.length; l++){
- assert.equal(entities.decodeStrict("&" + e, l), doc[e]);
+ assert.equal(entities.decodeStrict("&" + e + ";", l), doc[e]);
}
});
});
@@ -113,7 +99,6 @@ describe("Documents", function(){
describe("Encode", function(){
it(levels[i], function(){
Object.keys(doc).forEach(function(e){
- if(e.substr(-1) !== ";") return;
for(var l = i; l < levels.length; l++){
assert.equal(entities.decode(entities.encode(doc[e], l), l), doc[e]);
}
@@ -121,6 +106,18 @@ describe("Documents", function(){
});
});
});
+
+ var legacy = require("../entities/legacy.json");
+
+ describe("Legacy", function(){
+ it("should decode", runLegacy);
+ });
+
+ function runLegacy(){
+ Object.keys(legacy).forEach(function(e){
+ assert.equal(entities.decodeHTML("&" + e), legacy[e]);
+ });
+ }
});
var astral = {
--
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