PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/web.arc.t

http://github.com/alimoeeny/arc
Unknown | 41 lines | 31 code | 10 blank | 0 comment | 0 complexity | 32c114dfa4deb86a0f91c4799b76118e MD5 | raw file
 1(require "lib/arctap.arc")
 2
 3(test-iso "split-by works"
 4  '("abc" "d")
 5  (split-by "#" "abc#d"))
 6
 7(test-iso "strip-after works"
 8  "abc"
 9  (strip-after "abc#d" "#"))
10
11(test-iso "strip-after works when delimiter is absent"
12  "abc"
13  (strip-after "abc" "#"))
14
15(test-iso "parse-url works"
16  (obj resource "http" host "example.com" port 80 filename "foo")
17  (parse-url "http://example.com/foo"))
18
19(test-iso "parse-url detects port"
20  (obj resource "http" host "example.com" port 81 filename "foo")
21  (parse-url "http://example.com:81/foo"))
22
23(test-iso "parse-url detects nested directories"
24  (obj resource "http" host "example.com" port 81 filename "foo/bar")
25  (parse-url "http://example.com:81/foo/bar"))
26
27(test-iso "parse-url gives https the right port"
28  (obj resource "https" host "example.com" port 443 filename "foo/bar")
29  (parse-url "https://example.com/foo/bar"))
30
31(test-iso "parse-url makes url http by default"
32  (obj resource "http" host "example.com" port 81 filename "foo/bar")
33  (parse-url "example.com:81/foo/bar"))
34
35(test-iso "parse-url ignores anchor"
36  (obj resource "http" host "example.com" port 80 filename "foo")
37  (parse-url "http://example.com/foo#anchor"))
38
39(test-iso "parse-url handles query string"
40  (obj resource "http" host "example.com" port 80 filename "foo" query "bar=blah")
41  (parse-url "http://example.com/foo?bar=blah#anchor"))