on master help sign in
Merge pull request #690 from maxsnew/test-fix

Testing Fixes for Canonicalize

commita70ee89cdb22dfee6404a140ea4fdd9600c9b510 authorEvan Czaplicki <info@elm-lang.org> dateFri 18 Jul 2014, 15:16 (12 years ago) parenta8a53702b34f16
5 files changed+28−30
Elm-Test+1−1 IO+1−1 tests/libraries/LibraryTest.hs+4−2 tests/libraries/Test.elm+2−6 tests/libraries/Test/String.elm+20−20
Elm-Test+1−1

Submodule changed.

IO+1−1

Submodule changed.

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