Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/filterClasses.js

Issue 29900557: Issue 7016 - Convert serialization functions into generators (Closed)
Patch Set: Address PS2 Comments Created Oct. 12, 2018, 3:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/filterClasses.js
===================================================================
--- a/test/filterClasses.js
+++ b/test/filterClasses.js
@@ -191,30 +191,17 @@
let filter = Filter.fromText(text);
if (postInit)
postInit(filter);
let result = serializeFilter(filter);
test.equal(result.sort().join("\n"), expected.sort().join("\n"), text);
// Test round-trip
let filter2;
- let buffer = [];
- filter.serialize(buffer);
- if (buffer.length)
- {
- let map = Object.create(null);
- for (let line of buffer.slice(1))
- {
- if (/(.*?)=(.*)/.test(line))
- map[RegExp.$1] = RegExp.$2;
- }
- filter2 = Filter.fromObject(map);
- }
- else
- filter2 = Filter.fromText(filter.text);
+ filter2 = Filter.fromText(filter.text);
test.equal(serializeFilter(filter).join("\n"), serializeFilter(filter2).join("\n"), text + " deserialization");
}
exports.testFilterClassDefinitions = function(test)
{
test.equal(typeof Filter, "function", "typeof Filter");
test.equal(typeof InvalidFilter, "function", "typeof InvalidFilter");

Powered by Google App Engine
This is Rietveld