-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-runner.ls
42 lines (37 loc) · 1.08 KB
/
test-runner.ls
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
'use strict'
require('core-js')
require! {
assert
'./' : prelude
}
function assertType (expected)
(actual, message) ->
return if expected is typeof! actual
throw new assert.AssertionError {
message: message
actual: actual
expected: expected
operator: 'instanceof'
stackStartFunction: assertType
}
# Mock the Promise functions in old node versions
# (required for test of isPromise())
unless global.Promise
global.Promise = function Promise =>
# set global assert funcs
Object.assign global, {
prelude : prelude
ok : assert.ok
throws : assert.throws
deepEqual : assert.deepEqual
strictEqual : assert.strictEqual
isString : assertType 'String'
isNumber : assertType 'Number'
isFunction : assertType 'Function'
isObject : assertType 'Object'
isArray : assertType 'Array'
isRegExp : assertType 'RegExp'
isDate : assertType 'Date'
isError : assertType 'Error'
isArguments : assertType 'Arguments'
}