-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformat-test.js
More file actions
39 lines (35 loc) · 1.13 KB
/
Copy pathformat-test.js
File metadata and controls
39 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require("../env");
require("../../d3");
require("../../d3.csv");
var vows = require("vows"),
assert = require("assert");
var suite = vows.describe("d3.csv.format");
suite.addBatch({
"format": {
topic: function() {
return d3.csv.format;
},
"takes an array of arrays as input": function(format) {
assert.equal(format([["a", "b", "c"], ["1", "2", "3"]]), "a,b,c\n1,2,3");
},
"separates lines using unix newline": function(format) {
assert.equal(format([[], []]), "\n");
},
"does not strip whitespace": function(format) {
assert.equal(format([["a ", " b", "c"], ["1", "2", "3 "]]), "a , b,c\n1,2,3 ");
},
"does not quote simple values": function(format) {
assert.equal(format([["a"], [1]]), "a\n1");
},
"escapes double quotes": function(format) {
assert.equal(format([["\"fish\""]]), "\"\"\"fish\"\"\"");
},
"escapes unix newlines": function(format) {
assert.equal(format([["new\nline"]]), "\"new\nline\"");
},
"escapes commas": function(format) {
assert.equal(format([["oxford,comma"]]), "\"oxford,comma\"");
}
}
});
suite.export(module);