-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient-test-rsp.r3
52 lines (45 loc) · 1.14 KB
/
client-test-rsp.r3
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
Rebol [
Title: "Test HTTPd Scheme using RSP (client)"
File: %client-test-rsp.r3
Needs: 3.16.0
]
import 'json
print-horizontal-line
print as-green "Launching the server..."
pid: launch %server-test-rsp.r3
wait 0:0:1
print-horizontal-line
print as-green "Doing the tests..."
fails: 0
url: http://localhost:8083/
foreach test [
[ 1 == load url/test_01.rsp ]
[ 2 == load url/test_02.rsp ]
[ [method: GET values: []] == load url/test_03.rsp ]
[ [method: GET values: [a: "1" b: "2"]] == load url/test_03.rsp?a=1&b=2 ]
[ #[test: 4] == decode 'json read url/test_04.rsp ]
[ "124" == read url/test_05.rsp ]
[ "212456" == read url/test_06.rsp ]
[ "<%= 1 + 1 %>" == read url/test_07.rsp ]
][
print-horizontal-line
print [as-yellow "Assert:" mold/flat test]
result: try :test
print "------"
print either :result [
as-green "OK"
][
++ fails
as-red "FAILED"
]
print ""
]
print-horizontal-line
print as-green "Stopping the server..."
access-os/set 'pid :pid
wait 0:0:1
if fails > 0 [
print as-red [fails "tests have failed!"]
quit/return fails
]
print as-green "All tests have passed."