|
|
@ -12,10 +12,20 @@ test('pass', t => {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
test('anon func', t => {
|
|
|
|
test('anon func', t => {
|
|
|
|
|
|
|
|
const r = fx({"key": "value"}, "'function (x) { return x.key }'")
|
|
|
|
|
|
|
|
t.deepEqual(r, 'value\n')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('arrow func', t => {
|
|
|
|
const r = fx({"key": "value"}, "'x => x.key'")
|
|
|
|
const r = fx({"key": "value"}, "'x => x.key'")
|
|
|
|
t.deepEqual(r, 'value\n')
|
|
|
|
t.deepEqual(r, 'value\n')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test('arrow func ()', t => {
|
|
|
|
|
|
|
|
const r = fx({"key": "value"}, "'(x) => x.key'")
|
|
|
|
|
|
|
|
t.deepEqual(r, 'value\n')
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
test('this bind', t => {
|
|
|
|
test('this bind', t => {
|
|
|
|
const r = fx([1, 2, 3, 4, 5], "'this.map(x => x * this.length)'")
|
|
|
|
const r = fx([1, 2, 3, 4, 5], "'this.map(x => x * this.length)'")
|
|
|
|
t.deepEqual(JSON.parse(r), [5, 10, 15, 20, 25])
|
|
|
|
t.deepEqual(JSON.parse(r), [5, 10, 15, 20, 25])
|
|
|
|