@@ -3,79 +3,32 @@ module Test.Main where
3
3
import Prelude
4
4
5
5
import Effect (Effect )
6
- import Node.Path (basename , basenameWithoutExt , concat , delimiter , dirname , extname , normalize , parse , relative , sep )
6
+ import Node.Path (basename , basenameWithoutExt , concat , delimiter , dirname , extname , normalize , parse , relative , resolve , sep )
7
7
import Test.Assert (assert , assertEqual )
8
8
9
9
main :: Effect Unit
10
10
main = do
11
- assertEqual
12
- { actual: normalize " /foo/bar//baz/asdf/quux/.."
13
- , expected: normalize " /foo/bar/baz/asdf"
14
- }
15
- assertEqual
16
- { actual: concat [" /foo" , " bar" ]
17
- , expected: normalize " /foo/bar"
18
- }
19
- assertEqual
20
- { actual: relative " /data/orandea/test/aaa" " /data/orandea/impl/bbb"
21
- , expected: normalize " ../../impl/bbb"
22
- }
23
- assertEqual
24
- { actual: dirname " /foo/bar/baz/asdf/quux"
25
- , expected: normalize " /foo/bar/baz/asdf"
26
- }
27
- assertEqual
28
- { actual: basename " /foo/bar/baz/asdf/quux.html"
29
- , expected: " quux.html"
30
- }
31
- assertEqual
32
- { actual: basenameWithoutExt " /foo/bar/baz/asdf/quux.html" " .html"
33
- , expected: " quux"
34
- }
35
- assertEqual
36
- { actual: basenameWithoutExt " /foo/bar/baz/asdf/quux.txt" " .html"
37
- , expected: " quux.txt"
38
- }
39
- assertEqual
40
- { actual: extname " index.html"
41
- , expected: " .html"
42
- }
43
- assertEqual
44
- { actual: extname " index.coffee.md"
45
- , expected: " .md"
46
- }
47
- assertEqual
48
- { actual: extname " index."
49
- , expected: " ."
50
- }
51
- assertEqual
52
- { actual: extname " index"
53
- , expected: " "
54
- }
55
- assertEqual
56
- { actual: sep
57
- , expected: normalize " /"
58
- }
11
+ assertEqual { actual: normalize " /foo/bar//baz/asdf/quux/.." , expected: normalize " /foo/bar/baz/asdf" }
12
+ assertEqual { actual: concat [" /foo" , " bar" ], expected: normalize " /foo/bar" }
13
+ assertEqual { actual: relative " /data/orandea/test/aaa" " /data/orandea/impl/bbb" , expected: normalize " ../../impl/bbb" }
14
+ assertEqual { actual: dirname " /foo/bar/baz/asdf/quux" , expected: normalize " /foo/bar/baz/asdf" }
15
+ assertEqual { actual: basename " /foo/bar/baz/asdf/quux.html" , expected: " quux.html" }
16
+ assertEqual { actual: basenameWithoutExt " /foo/bar/baz/asdf/quux.html" " .html" , expected: " quux" }
17
+ assertEqual { actual: basenameWithoutExt " /foo/bar/baz/asdf/quux.txt" " .html" , expected: " quux.txt" }
18
+ assertEqual { actual: extname " index.html" , expected: " .html" }
19
+ assertEqual { actual: extname " index.coffee.md" , expected: " .md" }
20
+ assertEqual { actual: extname " index." , expected: " ." }
21
+ assertEqual { actual: extname " index" , expected: " " }
22
+ assertEqual { actual: sep, expected: normalize " /" }
59
23
assert $ delimiter == " ;" || delimiter == " :"
60
24
61
25
let path = parse " /home/user/file.js"
62
- assertEqual
63
- { actual: path.root
64
- , expected: " /"
65
- }
66
- assertEqual
67
- { actual: path.dir
68
- , expected: " /home/user"
69
- }
70
- assertEqual
71
- { actual: path.base
72
- , expected: " file.js"
73
- }
74
- assertEqual
75
- { actual: path.ext
76
- , expected: " .js"
77
- }
78
- assertEqual
79
- { actual: path.name
80
- , expected: " file"
81
- }
26
+ assertEqual { actual: path.root, expected: " /" }
27
+ assertEqual { actual: path.dir, expected: " /home/user" }
28
+ assertEqual { actual: path.base, expected: " file.js" }
29
+ assertEqual { actual: path.ext, expected: " .js" }
30
+ assertEqual { actual: path.name, expected: " file" }
31
+
32
+ path1 <- resolve [" a" ] " "
33
+ path2 <- resolve [" a" ] " ."
34
+ assertEqual { actual: path1, expected: path2 }
0 commit comments