@jdeighan/coffee-utils 4.1.5 → 4.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -2
- package/src/block_utils.coffee +1 -0
- package/src/block_utils.js +1 -0
- package/src/coffee_utils.coffee +40 -2
- package/src/coffee_utils.js +43 -2
- package/src/debug_utils.coffee +1 -0
- package/src/debug_utils.js +1 -0
- package/src/fs_utils.coffee +29 -3
- package/src/fs_utils.js +33 -3
- package/src/indent_utils.coffee +4 -1
- package/src/indent_utils.js +9 -4
- package/temp.js +26 -0
- package/.save/block.test.coffee +0 -185
- package/.save/block.test.js +0 -129
- package/.save/block2.test.coffee +0 -47
- package/.save/block2.test.js +0 -64
- package/.save/debug.test.coffee +0 -290
- package/.save/debug.test.js +0 -242
- package/.save/fs.test.coffee +0 -148
- package/.save/fs.test.js +0 -191
- package/.save/indent.test.coffee +0 -130
- package/.save/indent.test.js +0 -136
- package/.save/log.test.coffee +0 -315
- package/.save/log.test.js +0 -336
- package/.save/privenv.test.coffee +0 -38
- package/.save/privenv.test.js +0 -54
- package/.save/temp.coffee +0 -19
- package/.save/temp.js +0 -28
- package/.save/tester.test.coffee +0 -75
- package/.save/tester.test.js +0 -93
- package/.save/utils.test.coffee +0 -214
- package/.save/utils.test.js +0 -319
- package/src/private_env.coffee +0 -52
- package/src/private_env.js +0 -63
package/.save/indent.test.coffee
DELETED
@@ -1,130 +0,0 @@
|
|
1
|
-
# indent.test.coffee
|
2
|
-
|
3
|
-
import assert from 'assert'
|
4
|
-
|
5
|
-
import {UnitTester} from '@jdeighan/coffee-utils/test'
|
6
|
-
import {isInteger} from '@jdeighan/coffee-utils'
|
7
|
-
import {
|
8
|
-
indentLevel, indentation, undented, splitLine,
|
9
|
-
indented, tabify, untabify,
|
10
|
-
} from '@jdeighan/coffee-utils/indent'
|
11
|
-
|
12
|
-
simple = new UnitTester()
|
13
|
-
|
14
|
-
# ---------------------------------------------------------------------------
|
15
|
-
|
16
|
-
simple.equal 16, indentLevel("abc"), 0
|
17
|
-
simple.equal 17, indentLevel("\tabc"), 1
|
18
|
-
simple.equal 18, indentLevel("\t\tabc"), 2
|
19
|
-
|
20
|
-
# ---------------------------------------------------------------------------
|
21
|
-
|
22
|
-
simple.equal 22, indentation(0), ''
|
23
|
-
simple.equal 23, indentation(1), "\t"
|
24
|
-
simple.equal 24, indentation(2), "\t\t"
|
25
|
-
|
26
|
-
# ---------------------------------------------------------------------------
|
27
|
-
|
28
|
-
simple.equal 28, undented("abc"), "abc"
|
29
|
-
simple.equal 29, undented("\tabc"), "abc"
|
30
|
-
simple.equal 30, undented("\t\tabc"), "abc"
|
31
|
-
simple.equal 31, undented("\t\tabc", 0), "\t\tabc"
|
32
|
-
simple.equal 32, undented("\t\tabc", 1), "\tabc"
|
33
|
-
simple.equal 33, undented("\t\tabc", 2), "abc"
|
34
|
-
|
35
|
-
# ---------------------------------------------------------------------------
|
36
|
-
|
37
|
-
simple.equal 37, undented("\t\tfirst\n\t\tsecond\n\t\t\tthird\n"),
|
38
|
-
"first\nsecond\n\tthird\n",
|
39
|
-
|
40
|
-
# ---------------------------------------------------------------------------
|
41
|
-
|
42
|
-
simple.equal 42, splitLine("abc"), [0, "abc"]
|
43
|
-
simple.equal 43, splitLine("\tabc"), [1, "abc"]
|
44
|
-
simple.equal 44, splitLine("\t\tabc"), [2, "abc"]
|
45
|
-
simple.equal 45, splitLine("\t\t\t"), [0, ""]
|
46
|
-
|
47
|
-
# ---------------------------------------------------------------------------
|
48
|
-
|
49
|
-
simple.equal 49, indented("abc", 0), "abc"
|
50
|
-
simple.equal 50, indented("abc", 1), "\tabc"
|
51
|
-
simple.equal 51, indented("abc", 2), "\t\tabc"
|
52
|
-
|
53
|
-
# --- empty lines, indented, should just be empty lines
|
54
|
-
simple.equal 54, indented("abc\n\ndef", 2), "\t\tabc\n\n\t\tdef"
|
55
|
-
|
56
|
-
(() ->
|
57
|
-
str = "main\n\toverflow: auto\n\nnav\n\toverflow: auto"
|
58
|
-
exp = "\tmain\n\t\toverflow: auto\n\n\tnav\n\t\toverflow: auto"
|
59
|
-
simple.equal 59, indented(str, 1), exp
|
60
|
-
)()
|
61
|
-
|
62
|
-
# --- indented also handles arrays, so test them, too
|
63
|
-
|
64
|
-
# --- empty lines, indented, should just be empty lines
|
65
|
-
simple.equal 65, indented(['abc','','def'], 2), '\t\tabc\n\n\t\tdef'
|
66
|
-
|
67
|
-
(() ->
|
68
|
-
lLines = ['main','\toverflow: auto','','nav','\toverflow: auto']
|
69
|
-
lExp = '\tmain\n\t\toverflow: auto\n\n\tnav\n\t\toverflow: auto'
|
70
|
-
simple.equal 70, indented(lLines, 1), lExp
|
71
|
-
)()
|
72
|
-
|
73
|
-
# ---------------------------------------------------------------------------
|
74
|
-
|
75
|
-
(() ->
|
76
|
-
prefix = ' ' # 3 spaces
|
77
|
-
|
78
|
-
simple.equal 78, tabify("""
|
79
|
-
first line
|
80
|
-
#{prefix}second line
|
81
|
-
#{prefix}#{prefix}third line
|
82
|
-
""", 3), """
|
83
|
-
first line
|
84
|
-
\tsecond line
|
85
|
-
\t\tthird line
|
86
|
-
"""
|
87
|
-
)()
|
88
|
-
|
89
|
-
# ---------------------------------------------------------------------------
|
90
|
-
# you don't need to tell it number of spaces
|
91
|
-
|
92
|
-
(() ->
|
93
|
-
prefix = ' ' # 3 spaces
|
94
|
-
|
95
|
-
simple.equal 95, tabify("""
|
96
|
-
first line
|
97
|
-
#{prefix}second line
|
98
|
-
#{prefix}#{prefix}third line
|
99
|
-
"""), """
|
100
|
-
first line
|
101
|
-
\tsecond line
|
102
|
-
\t\tthird line
|
103
|
-
"""
|
104
|
-
)()
|
105
|
-
|
106
|
-
# ---------------------------------------------------------------------------
|
107
|
-
|
108
|
-
(() ->
|
109
|
-
prefix = ' ' # 3 spaces
|
110
|
-
|
111
|
-
simple.equal 111, untabify("""
|
112
|
-
first line
|
113
|
-
\tsecond line
|
114
|
-
\t\tthird line
|
115
|
-
""", 3), """
|
116
|
-
first line
|
117
|
-
#{prefix}second line
|
118
|
-
#{prefix}#{prefix}third line
|
119
|
-
"""
|
120
|
-
)()
|
121
|
-
|
122
|
-
# ---------------------------------------------------------------------------
|
123
|
-
|
124
|
-
simple.equal 124, indented("export name = undef", 1), "\texport name = undef"
|
125
|
-
simple.equal 125, indented("export name = undef", 2), "\t\texport name = undef"
|
126
|
-
|
127
|
-
# ---------------------------------------------------------------------------
|
128
|
-
# make sure indentLevel() works for blocks
|
129
|
-
|
130
|
-
simple.equal 130, indentLevel("\t\tabc\n\t\tdef\n\t\t\tghi"), 2
|
package/.save/indent.test.js
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
// Generated by CoffeeScript 2.6.1
|
2
|
-
// indent.test.coffee
|
3
|
-
var simple;
|
4
|
-
|
5
|
-
import assert from 'assert';
|
6
|
-
|
7
|
-
import {
|
8
|
-
UnitTester
|
9
|
-
} from '@jdeighan/coffee-utils/test';
|
10
|
-
|
11
|
-
import {
|
12
|
-
isInteger
|
13
|
-
} from '@jdeighan/coffee-utils';
|
14
|
-
|
15
|
-
import {
|
16
|
-
indentLevel,
|
17
|
-
indentation,
|
18
|
-
undented,
|
19
|
-
splitLine,
|
20
|
-
indented,
|
21
|
-
tabify,
|
22
|
-
untabify
|
23
|
-
} from '@jdeighan/coffee-utils/indent';
|
24
|
-
|
25
|
-
simple = new UnitTester();
|
26
|
-
|
27
|
-
// ---------------------------------------------------------------------------
|
28
|
-
simple.equal(16, indentLevel("abc"), 0);
|
29
|
-
|
30
|
-
simple.equal(17, indentLevel("\tabc"), 1);
|
31
|
-
|
32
|
-
simple.equal(18, indentLevel("\t\tabc"), 2);
|
33
|
-
|
34
|
-
// ---------------------------------------------------------------------------
|
35
|
-
simple.equal(22, indentation(0), '');
|
36
|
-
|
37
|
-
simple.equal(23, indentation(1), "\t");
|
38
|
-
|
39
|
-
simple.equal(24, indentation(2), "\t\t");
|
40
|
-
|
41
|
-
// ---------------------------------------------------------------------------
|
42
|
-
simple.equal(28, undented("abc"), "abc");
|
43
|
-
|
44
|
-
simple.equal(29, undented("\tabc"), "abc");
|
45
|
-
|
46
|
-
simple.equal(30, undented("\t\tabc"), "abc");
|
47
|
-
|
48
|
-
simple.equal(31, undented("\t\tabc", 0), "\t\tabc");
|
49
|
-
|
50
|
-
simple.equal(32, undented("\t\tabc", 1), "\tabc");
|
51
|
-
|
52
|
-
simple.equal(33, undented("\t\tabc", 2), "abc");
|
53
|
-
|
54
|
-
// ---------------------------------------------------------------------------
|
55
|
-
simple.equal(37, undented("\t\tfirst\n\t\tsecond\n\t\t\tthird\n"), "first\nsecond\n\tthird\n");
|
56
|
-
|
57
|
-
// ---------------------------------------------------------------------------
|
58
|
-
simple.equal(42, splitLine("abc"), [0, "abc"]);
|
59
|
-
|
60
|
-
simple.equal(43, splitLine("\tabc"), [1, "abc"]);
|
61
|
-
|
62
|
-
simple.equal(44, splitLine("\t\tabc"), [2, "abc"]);
|
63
|
-
|
64
|
-
simple.equal(45, splitLine("\t\t\t"), [0, ""]);
|
65
|
-
|
66
|
-
// ---------------------------------------------------------------------------
|
67
|
-
simple.equal(49, indented("abc", 0), "abc");
|
68
|
-
|
69
|
-
simple.equal(50, indented("abc", 1), "\tabc");
|
70
|
-
|
71
|
-
simple.equal(51, indented("abc", 2), "\t\tabc");
|
72
|
-
|
73
|
-
// --- empty lines, indented, should just be empty lines
|
74
|
-
simple.equal(54, indented("abc\n\ndef", 2), "\t\tabc\n\n\t\tdef");
|
75
|
-
|
76
|
-
(function() {
|
77
|
-
var exp, str;
|
78
|
-
str = "main\n\toverflow: auto\n\nnav\n\toverflow: auto";
|
79
|
-
exp = "\tmain\n\t\toverflow: auto\n\n\tnav\n\t\toverflow: auto";
|
80
|
-
return simple.equal(59, indented(str, 1), exp);
|
81
|
-
})();
|
82
|
-
|
83
|
-
// --- indented also handles arrays, so test them, too
|
84
|
-
|
85
|
-
// --- empty lines, indented, should just be empty lines
|
86
|
-
simple.equal(65, indented(['abc', '', 'def'], 2), '\t\tabc\n\n\t\tdef');
|
87
|
-
|
88
|
-
(function() {
|
89
|
-
var lExp, lLines;
|
90
|
-
lLines = ['main', '\toverflow: auto', '', 'nav', '\toverflow: auto'];
|
91
|
-
lExp = '\tmain\n\t\toverflow: auto\n\n\tnav\n\t\toverflow: auto';
|
92
|
-
return simple.equal(70, indented(lLines, 1), lExp);
|
93
|
-
})();
|
94
|
-
|
95
|
-
// ---------------------------------------------------------------------------
|
96
|
-
(function() {
|
97
|
-
var prefix;
|
98
|
-
prefix = ' '; // 3 spaces
|
99
|
-
return simple.equal(78, tabify(`first line
|
100
|
-
${prefix}second line
|
101
|
-
${prefix}${prefix}third line`, 3), `first line
|
102
|
-
\tsecond line
|
103
|
-
\t\tthird line`);
|
104
|
-
})();
|
105
|
-
|
106
|
-
// ---------------------------------------------------------------------------
|
107
|
-
// you don't need to tell it number of spaces
|
108
|
-
(function() {
|
109
|
-
var prefix;
|
110
|
-
prefix = ' '; // 3 spaces
|
111
|
-
return simple.equal(95, tabify(`first line
|
112
|
-
${prefix}second line
|
113
|
-
${prefix}${prefix}third line`), `first line
|
114
|
-
\tsecond line
|
115
|
-
\t\tthird line`);
|
116
|
-
})();
|
117
|
-
|
118
|
-
// ---------------------------------------------------------------------------
|
119
|
-
(function() {
|
120
|
-
var prefix;
|
121
|
-
prefix = ' '; // 3 spaces
|
122
|
-
return simple.equal(111, untabify(`first line
|
123
|
-
\tsecond line
|
124
|
-
\t\tthird line`, 3), `first line
|
125
|
-
${prefix}second line
|
126
|
-
${prefix}${prefix}third line`);
|
127
|
-
})();
|
128
|
-
|
129
|
-
// ---------------------------------------------------------------------------
|
130
|
-
simple.equal(124, indented("export name = undef", 1), "\texport name = undef");
|
131
|
-
|
132
|
-
simple.equal(125, indented("export name = undef", 2), "\t\texport name = undef");
|
133
|
-
|
134
|
-
// ---------------------------------------------------------------------------
|
135
|
-
// make sure indentLevel() works for blocks
|
136
|
-
simple.equal(130, indentLevel("\t\tabc\n\t\tdef\n\t\t\tghi"), 2);
|
package/.save/log.test.coffee
DELETED
@@ -1,315 +0,0 @@
|
|
1
|
-
# log.test.coffee
|
2
|
-
|
3
|
-
import {undef} from '@jdeighan/coffee-utils'
|
4
|
-
import {arrayToBlock} from '@jdeighan/coffee-utils/block'
|
5
|
-
import {UnitTester} from '@jdeighan/coffee-utils/test'
|
6
|
-
import {
|
7
|
-
stringify, setStringifier, log, setLogger, tamlStringify,
|
8
|
-
} from '@jdeighan/coffee-utils/log'
|
9
|
-
|
10
|
-
simple = new UnitTester()
|
11
|
-
|
12
|
-
# ---------------------------------------------------------------------------
|
13
|
-
|
14
|
-
class LogTester extends UnitTester
|
15
|
-
|
16
|
-
transformValue: (lLines) ->
|
17
|
-
return arrayToBlock(lLines)
|
18
|
-
normalize: (text) ->
|
19
|
-
return text
|
20
|
-
|
21
|
-
tester = new LogTester()
|
22
|
-
|
23
|
-
# ---------------------------------------------------------------------------
|
24
|
-
|
25
|
-
lLines = undef
|
26
|
-
setLogger (str) -> lLines.push(str)
|
27
|
-
|
28
|
-
# ---------------------------------------------------------------------------
|
29
|
-
|
30
|
-
(() ->
|
31
|
-
lLines = []
|
32
|
-
log 'enter myfunc'
|
33
|
-
tester.equal 33, lLines, """
|
34
|
-
enter myfunc
|
35
|
-
"""
|
36
|
-
)()
|
37
|
-
|
38
|
-
# ---------------------------------------------------------------------------
|
39
|
-
|
40
|
-
(() ->
|
41
|
-
lLines = []
|
42
|
-
log 'abc'
|
43
|
-
log 'def'
|
44
|
-
log 'ghi'
|
45
|
-
tester.equal 45, lLines, """
|
46
|
-
abc
|
47
|
-
def
|
48
|
-
ghi
|
49
|
-
"""
|
50
|
-
)()
|
51
|
-
|
52
|
-
# ---------------------------------------------------------------------------
|
53
|
-
# test logging various small objects
|
54
|
-
|
55
|
-
(() ->
|
56
|
-
lLines = []
|
57
|
-
log 'abc'
|
58
|
-
log 'name', undef
|
59
|
-
tester.equal 59, lLines, """
|
60
|
-
abc
|
61
|
-
name = undef
|
62
|
-
"""
|
63
|
-
)()
|
64
|
-
|
65
|
-
(() ->
|
66
|
-
lLines = []
|
67
|
-
log 'abc'
|
68
|
-
log 'name', 42
|
69
|
-
tester.equal 68, lLines, """
|
70
|
-
abc
|
71
|
-
name = 42
|
72
|
-
"""
|
73
|
-
)()
|
74
|
-
|
75
|
-
(() ->
|
76
|
-
lLines = []
|
77
|
-
log 'abc'
|
78
|
-
log 'name', 'John'
|
79
|
-
tester.equal 79, lLines, """
|
80
|
-
abc
|
81
|
-
name = 'John'
|
82
|
-
"""
|
83
|
-
)()
|
84
|
-
|
85
|
-
(() ->
|
86
|
-
lLines = []
|
87
|
-
log 'abc'
|
88
|
-
log 'name', {a: 1, b: 'xyz'}
|
89
|
-
tester.equal 89, lLines, """
|
90
|
-
abc
|
91
|
-
name = {"a":1,"b":"xyz"}
|
92
|
-
"""
|
93
|
-
)()
|
94
|
-
|
95
|
-
(() ->
|
96
|
-
lLines = []
|
97
|
-
log 'abc'
|
98
|
-
log 'name', ['a', 42, [1,2]]
|
99
|
-
tester.equal 99, lLines, """
|
100
|
-
abc
|
101
|
-
name = ["a",42,[1,2]]
|
102
|
-
"""
|
103
|
-
)()
|
104
|
-
|
105
|
-
# ---------------------------------------------------------------------------
|
106
|
-
# test logging various large objects
|
107
|
-
|
108
|
-
(() ->
|
109
|
-
lLines = []
|
110
|
-
log 'abc'
|
111
|
-
log 'name', """
|
112
|
-
This is a rather long bit of
|
113
|
-
text which changes
|
114
|
-
how it's displayed
|
115
|
-
"""
|
116
|
-
tester.equal 116, lLines, """
|
117
|
-
abc
|
118
|
-
name:
|
119
|
-
==========================================
|
120
|
-
This is a rather long bit of
|
121
|
-
text which changes
|
122
|
-
how it's displayed
|
123
|
-
==========================================
|
124
|
-
"""
|
125
|
-
)()
|
126
|
-
|
127
|
-
(() ->
|
128
|
-
lLines = []
|
129
|
-
log 'abc'
|
130
|
-
log 'name', {
|
131
|
-
fname: 'John',
|
132
|
-
lname: 'Deighan',
|
133
|
-
age: 68,
|
134
|
-
home: 'Blacksburg, VA',
|
135
|
-
}
|
136
|
-
tester.equal 134, lLines, """
|
137
|
-
abc
|
138
|
-
name:
|
139
|
-
---
|
140
|
-
fname: John
|
141
|
-
lname: Deighan
|
142
|
-
age: 68
|
143
|
-
home: Blacksburg, VA
|
144
|
-
"""
|
145
|
-
)()
|
146
|
-
|
147
|
-
(() ->
|
148
|
-
lLines = []
|
149
|
-
log 'abc'
|
150
|
-
log 'name', [
|
151
|
-
68,
|
152
|
-
'a rather long string of text',
|
153
|
-
{a:1, b:2}
|
154
|
-
]
|
155
|
-
tester.equal 153, lLines, """
|
156
|
-
abc
|
157
|
-
name:
|
158
|
-
---
|
159
|
-
- 68
|
160
|
-
- a rather long string of text
|
161
|
-
-
|
162
|
-
a: 1
|
163
|
-
b: 2
|
164
|
-
"""
|
165
|
-
)()
|
166
|
-
|
167
|
-
# ---------------------------------------------------------------------------
|
168
|
-
# test providing a prefix
|
169
|
-
|
170
|
-
(() ->
|
171
|
-
lLines = []
|
172
|
-
log 'name', undef, {prefix: '<-->', logItem: true}
|
173
|
-
tester.equal 171, lLines, """
|
174
|
-
<-->name = undef
|
175
|
-
"""
|
176
|
-
)()
|
177
|
-
|
178
|
-
(() ->
|
179
|
-
lLines = []
|
180
|
-
log 'name', 42, {prefix: '<-->', logItem: true}
|
181
|
-
tester.equal 179, lLines, """
|
182
|
-
<-->name = 42
|
183
|
-
"""
|
184
|
-
)()
|
185
|
-
|
186
|
-
(() ->
|
187
|
-
lLines = []
|
188
|
-
log 'name', 'John', {prefix: '<-->', logItem: true}
|
189
|
-
tester.equal 187, lLines, """
|
190
|
-
<-->name = 'John'
|
191
|
-
"""
|
192
|
-
)()
|
193
|
-
|
194
|
-
(() ->
|
195
|
-
lLines = []
|
196
|
-
log 'name', {a: 1, b: 'xyz'}, {prefix: '<-->', logItem: true}
|
197
|
-
tester.equal 195, lLines, """
|
198
|
-
<-->name = {"a":1,"b":"xyz"}
|
199
|
-
"""
|
200
|
-
)()
|
201
|
-
|
202
|
-
(() ->
|
203
|
-
lLines = []
|
204
|
-
log 'name', ['a', 42, [1,2]], {prefix: '<-->', logItem: true}
|
205
|
-
tester.equal 203, lLines, """
|
206
|
-
<-->name = ["a",42,[1,2]]
|
207
|
-
"""
|
208
|
-
)()
|
209
|
-
|
210
|
-
(() ->
|
211
|
-
lLines = []
|
212
|
-
log 'name', """
|
213
|
-
This is a rather long bit of
|
214
|
-
text which changes
|
215
|
-
how it's displayed
|
216
|
-
""", {prefix: '<-->', logItem: true}
|
217
|
-
tester.equal 215, lLines, """
|
218
|
-
<-->name:
|
219
|
-
==========================================
|
220
|
-
This is a rather long bit of
|
221
|
-
text which changes
|
222
|
-
how it's displayed
|
223
|
-
==========================================
|
224
|
-
"""
|
225
|
-
)()
|
226
|
-
|
227
|
-
(() ->
|
228
|
-
lLines = []
|
229
|
-
log 'name', {
|
230
|
-
fname: 'John',
|
231
|
-
lname: 'Deighan',
|
232
|
-
age: 68,
|
233
|
-
home: 'Blacksburg, VA',
|
234
|
-
}, {prefix: '<-->', logItem: true}
|
235
|
-
tester.equal 231, lLines, """
|
236
|
-
<-->name:
|
237
|
-
---
|
238
|
-
fname: John
|
239
|
-
lname: Deighan
|
240
|
-
age: 68
|
241
|
-
home: Blacksburg, VA
|
242
|
-
"""
|
243
|
-
)()
|
244
|
-
|
245
|
-
(() ->
|
246
|
-
lLines = []
|
247
|
-
log 'name', [
|
248
|
-
68,
|
249
|
-
'a rather long string of text',
|
250
|
-
{a:1, b:2}
|
251
|
-
], {prefix: '<-->', logItem: true}
|
252
|
-
tester.equal 248, lLines, """
|
253
|
-
<-->name:
|
254
|
-
---
|
255
|
-
- 68
|
256
|
-
- a rather long string of text
|
257
|
-
-
|
258
|
-
a: 1
|
259
|
-
b: 2
|
260
|
-
"""
|
261
|
-
)()
|
262
|
-
|
263
|
-
# ---------------------------------------------------------------------------
|
264
|
-
|
265
|
-
simple.equal 261, tamlStringify({a:"word", b:"blind"}), """
|
266
|
-
---
|
267
|
-
a: word
|
268
|
-
b: blind
|
269
|
-
"""
|
270
|
-
simple.equal 266, stringify({a:"word", b:"blind"}), """
|
271
|
-
---
|
272
|
-
a: word
|
273
|
-
b: blind
|
274
|
-
"""
|
275
|
-
|
276
|
-
setStringifier(JSON.stringify)
|
277
|
-
|
278
|
-
simple.equal 274, stringify({a:"word", b:"blind"}),
|
279
|
-
'{"a":"word","b":"blind"}'
|
280
|
-
|
281
|
-
setStringifier(tamlStringify)
|
282
|
-
|
283
|
-
simple.equal 279, stringify({a:"word", b:"blind"}), """
|
284
|
-
---
|
285
|
-
a: word
|
286
|
-
b: blind
|
287
|
-
"""
|
288
|
-
|
289
|
-
# ---------------------------------------------------------------------------
|
290
|
-
|
291
|
-
(() ->
|
292
|
-
lItems = []
|
293
|
-
setLogger (item) -> lItems.push(item)
|
294
|
-
log 'a'
|
295
|
-
log 'b'
|
296
|
-
log 'c'
|
297
|
-
setLogger() # reset
|
298
|
-
|
299
|
-
simple.equal 295, lItems, ['a','b','c']
|
300
|
-
)()
|
301
|
-
|
302
|
-
(() ->
|
303
|
-
lItems = []
|
304
|
-
setLogger (item) -> lItems.push(item)
|
305
|
-
log 'a'
|
306
|
-
log 'b'
|
307
|
-
log 'c'
|
308
|
-
setLogger() # reset
|
309
|
-
|
310
|
-
simple.equal 306, lItems, ['a','b','c']
|
311
|
-
)()
|
312
|
-
|
313
|
-
simple.fails 309, () -> error("an error message")
|
314
|
-
|
315
|
-
# ---------------------------------------------------------------------------
|