@@ -14,9 +14,15 @@ describe "moonc", ->
1414
1515 it " should normalize dir" , ->
1616 same moonc. normalize_dir, " hello/world/" , " hello/world/"
17+ same moonc. normalize_dir, " /hello/world/" , " /hello/world/"
1718 same moonc. normalize_dir, " hello/world//" , " hello/world/"
18- same moonc. normalize_dir, " " , " /" -- wrong
19+ same moonc. normalize_dir, " /hello/world//" , " /hello/world/"
20+ same moonc. normalize_dir, " hello//world//" , " hello/world/"
21+ same moonc. normalize_dir, " /hello//world//" , " /hello/world/"
22+ same moonc. normalize_dir, " " , " "
23+ same moonc. normalize_dir, " /" , " /"
1924 same moonc. normalize_dir, " hello" , " hello/"
25+ same moonc. normalize_dir, " /hello" , " /hello/"
2026
2127 it " should parse dir" , ->
2228 same moonc. parse_dir, " /hello/world/file" , " /hello/world/"
@@ -35,6 +41,25 @@ describe "moonc", ->
3541 same moonc. convert_path, " /hello/file.moon" , " /hello/file.lua"
3642 same moonc. convert_path, " /hello/world/file" , " /hello/world/file.lua"
3743
44+ it " iterates paths" , ->
45+ single = { " foo" }
46+ single_path = " foo"
47+ nested = { " foo" , " bar" }
48+ nested_path = " foo/bar"
49+ nested_file = { " foo" , " bar.baz" }
50+ nested_file_path = " foo/bar.baz"
51+
52+ same_iterated_path = ( path, comparison_tbl) ->
53+ i = 0
54+ for path_element in moonc. iterate_path( path)
55+ i += 1
56+ assert . same comparison_tbl[ i] , path_element
57+ assert . same # comparison_tbl, i
58+
59+ same_iterated_path single_path, single
60+ same_iterated_path nested_path, nested
61+ same_iterated_path nested_file_path, nested_file
62+
3863 it " calculate target" , ->
3964 p = moonc. path_to_target
4065
0 commit comments