on master help sign in
Merge pull request #690 from maxsnew/test-fix
a70ee89Evan Czaplicki
Elm-Test+1−1

Submodule changed.

IO+1−1

Submodule changed.

tests/libraries/LibraryTest.hs+4−2
@@ -25,13 +25,13 @@ main = do
25 , "--src-dir=IO"
25 , "--src-dir=IO"
26 , "--src-dir=Elm-Test"
26 , "--src-dir=Elm-Test"
27 , "--src-dir=" ++ "tests" </> "libraries"
27 , "--src-dir=" ++ "tests" </> "libraries"
28− , "Test.elm"
28+ , testFile <.> "elm"
29 ]
29 ]
30
30
31 -- run tests
31 -- run tests
32 let files = [ "IO" </> "share" </> "prescript.js"
32 let files = [ "IO" </> "share" </> "prescript.js"
33 , Elm.runtime
33 , Elm.runtime
34− , "build" </> "Test.js"
34+ , "build" </> testFile <.> "js"
35 , "IO" </> "share" </> "handler.js"
35 , "IO" </> "share" </> "handler.js"
36 ]
36 ]
37 testRunner = "build" </> "TestRunner.js"
37 testRunner = "build" </> "TestRunner.js"
@@ -41,6 +41,8 @@ main = do
41 removeDirectoryRecursive "cache"
41 removeDirectoryRecursive "cache"
42 removeDirectoryRecursive "build"
42 removeDirectoryRecursive "build"
43 exitWith exitCode
43 exitWith exitCode
44+ where
45+ testFile = "tests" </> "libraries" </> "Test"
44
46
45runCmd :: String -> [String] -> IO ()
47runCmd :: String -> [String] -> IO ()
46runCmd cmd args = do
48runCmd cmd args = do
tests/libraries/Test.elm+2−6
@@ -4,7 +4,6 @@ import ElmTest.Assertion as A
4import ElmTest.Run as R
4import ElmTest.Run as R
5import ElmTest.Runner.Console (runDisplay)
5import ElmTest.Runner.Console (runDisplay)
6import ElmTest.Test (..)
6import ElmTest.Test (..)
7−
8import IO.IO (..)
7import IO.IO (..)
9import IO.Runner (Request, Response)
8import IO.Runner (Request, Response)
10import IO.Runner as Run
9import IO.Runner as Run
@@ -33,10 +32,7 @@ tests = suite "Elm Standard Library Tests"
33console : IO ()
32console : IO ()
34console = runDisplay tests
33console = runDisplay tests
35
34
36−port requests : Signal [{ mPut : Maybe String
35+port requests : Signal Request
37− , mExit : Maybe Int
38− , mGet : Bool
39− }]
40port requests = Run.run responses console
36port requests = Run.run responses console
41
37
42−port responses : Signal (Maybe String)
38+port responses : Signal Response
tests/libraries/Test/String.elm+20−20
@@ -1,7 +1,7 @@
1module Test.String (tests) where
1module Test.String (tests) where
2
2
3import List
3import List
4−import String (..)
4+import String
5
5
6import ElmTest.Assertion (..)
6import ElmTest.Assertion (..)
7import ElmTest.Test (..)
7import ElmTest.Test (..)
@@ -9,29 +9,29 @@ import ElmTest.Test (..)
9tests : Test
9tests : Test
10tests =
10tests =
11 let simpleTests = suite "Simple Stuff"
11 let simpleTests = suite "Simple Stuff"
12− [ test "is empty" <| assert (isEmpty "")
12+ [ test "is empty" <| assert (String.isEmpty "")
13− , test "is not empty" <| assert (not (isEmpty ("the world")))
13+ , test "is not empty" <| assert (not (String.isEmpty ("the world")))
14− , test "length" <| assertEqual 11 (length "innumerable")
14+ , test "length" <| assertEqual 11 (String.length "innumerable")
15− , test "endsWith" (assert <| endsWith "ship" "spaceship")
15+ , test "endsWith" (assert <| String.endsWith "ship" "spaceship")
16− , test "reverse" <| assertEqual "desserts" (reverse "stressed")
16+ , test "reverse" <| assertEqual "desserts" (String.reverse "stressed")
17− , test "repeat" <| assertEqual "hahaha" (repeat 3 "ha")
17+ , test "repeat" <| assertEqual "hahaha" (String.repeat 3 "ha")
18 ]
18 ]
19
19
20 combiningTests = suite "Combining Strings"
20 combiningTests = suite "Combining Strings"
21− [ test "uncons non-empty" <| assertEqual (Just ('a',"bc")) (uncons "abc")
21+ [ test "uncons non-empty" <| assertEqual (Just ('a',"bc")) (String.uncons "abc")
22− , test "uncons empty" <| assertEqual Nothing (uncons "")
22+ , test "uncons empty" <| assertEqual Nothing (String.uncons "")
23− , test "append 1" <| assertEqual "butterfly" (append "butter" "fly")
23+ , test "append 1" <| assertEqual "butterfly" (String.append "butter" "fly")
24− , test "append 2" <| assertEqual "butter" (append "butter" "")
24+ , test "append 2" <| assertEqual "butter" (String.append "butter" "")
25− , test "append 3" <| assertEqual "butter" (append "" "butter")
25+ , test "append 3" <| assertEqual "butter" (String.append "" "butter")
26 , test "concat" <| assertEqual "nevertheless" (concat ["never","the","less"])
26 , test "concat" <| assertEqual "nevertheless" (concat ["never","the","less"])
27− , test "split commas" <| assertEqual ["cat","dog","cow"] (split "," "cat,dog,cow")
27+ , test "split commas" <| assertEqual ["cat","dog","cow"] (String.split "," "cat,dog,cow")
28− , test "split slashes"<| assertEqual ["home","steve","Desktop", ""] (split "/" "home/steve/Desktop/")
28+ , test "split slashes"<| assertEqual ["home","steve","Desktop", ""] (String.split "/" "home/steve/Desktop/")
29− , test "join spaces" <| assertEqual "cat dog cow" (join " " ["cat","dog","cow"])
29+ , test "join spaces" <| assertEqual "cat dog cow" (String.join " " ["cat","dog","cow"])
30− , test "join slashes" <| assertEqual "home/steve/Desktop" (join "/" ["home","steve","Desktop"])
30+ , test "join slashes" <| assertEqual "home/steve/Desktop" (String.join "/" ["home","steve","Desktop"])
31− , test "slice 1" <| assertEqual "c" (slice 2 3 "abcd")
31+ , test "slice 1" <| assertEqual "c" (String.slice 2 3 "abcd")
32− , test "slice 2" <| assertEqual "abc" (slice 0 3 "abcd")
32+ , test "slice 2" <| assertEqual "abc" (String.slice 0 3 "abcd")
33− , test "slice 3" <| assertEqual "abc" (slice 0 -1 "abcd")
33+ , test "slice 3" <| assertEqual "abc" (String.slice 0 -1 "abcd")
34− , test "slice 4" <| assertEqual "cd" (slice -2 4 "abcd")
34+ , test "slice 4" <| assertEqual "cd" (String.slice -2 4 "abcd")
35 ]
35 ]
36 in
36 in
37 suite "String" [ simpleTests, combiningTests ]
37 suite "String" [ simpleTests, combiningTests ]