-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ls
136 lines (65 loc) · 1.33 KB
/
test.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
flyd-until = require "./main.js"
flyd = require "flyd"
wait = (t,f) -> setTimeout f,t
fail = (num) !->
console.error "[TEST ERROR] originating from module [ github.com/sourcevault/#{MODULE_NAME} ]\\n
\t - 'npm test' failed at TEST #{num}. \n
"
process.exitCode = 1
# TEST TYPE :: Functionality Tests
# # <| TEST 1 |>
send = flyd.stream!
$send = flyd-until 3,send
vals = []
$send.map (x) !->
vals.push x
do
<-! wait 100
send 1
do
<-! wait 100
send 2
do
<-! wait 100
send 3
do
<-! wait 100
send 4
do
<-! wait 100
send 5
do
<-! wait 103
if not vals.length is 3
fail 1
# TEST TYPE :: Throw Error Tests
# # <| TEST 2 |>
console.log "<| TEST 2 |>"
flyd-until 1.2,send
# # <| TEST 3 |>
console.log "<| TEST 3 |>"
flyd-until -1,send
# # <| TEST 4 |>
console.log "<| TEST 4 |>"
flyd-until -1.3,send
# # <| TEST 5 |>
console.log "<| TEST 5 |>"
flyd-until {},send
# # <| TEST 6 |>
console.log "<| TEST 6 |>"
flyd-until !->,send
# # <| TEST 7 |>
console.log "<| TEST 7 |>"
flyd-until null,send
# # <| TEST 8 |>
console.log "<| TEST 8 |>"
flyd-until undefined,send
# # <| TEST 9 |>
console.log "<| TEST 9 |>"
flyd-until Infinity,send
# # <| TEST 10 |>
console.log "<| TEST 10 |>"
flyd-until 100,{}
# # <| TEST 11 |>
console.log "<| TEST 11 |>"
flyd-until 100,[]