-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
43 lines (34 loc) · 979 Bytes
/
test.js
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
40
41
42
43
var test = require('tape');
var deval = require('./deval');
test('it serializes multiline code', function (t) {
var serialized = deval(function () {
console.log('hi');
console.log('there');
});
var expected = [
"console.log('hi');",
"console.log('there');"
].join('\n');
t.equal(serialized, expected);
t.end();
});
test('it serializes inline code', function (t) {
var serialized = deval(function () { console.log('hi'); console.log('there'); });
var expected = [
"console.log('hi'); console.log('there');"
].join('\n');
t.equal(serialized, expected);
t.end();
});
test('it even interpolates things', function (t) {
var serialized = deval(function (foo, bar) {
console.log('$foo$');
console.log($bar$);
}, "hi", 5);
var expected = [
"console.log('hi');",
"console.log(5);"
].join('\n');
t.equal(serialized, expected);
t.end();
});