on master help sign in
Merge branch 'master' into topic/kbd_caper
commit9a56f13089486363703aca774b8d06df8f95e855 authorJohn P Mayer Jr <john.p.mayer.jr@gmail.com> dateSun 18 Aug 2013, 02:04 (13 years ago) parentb8a270ec608e75
9 files changed+30−34
Elm.cabal+1−1 compiler/Generate/JavaScript.hs+8−8 compiler/Parse/Type.hs+1−1 runtime/Render/Element.js+2−2 runtime/Render/Utils.js+2−2 tests/Main.hs+16−3 tests/test−7 tests/testRepl−5 tests/tests/.ghci−5
Elm.cabal+1−1
@@ -168,4 +168,4 @@ Test-Suite test-elm
168168 Type: exitcode-stdio-1.0
169169 Hs-Source-Dirs: tests
170170 Main-is: Main.hs
171− build-depends: base, HTF
171+ build-depends: base, directory, HTF
compiler/Generate/JavaScript.hs+8−8
@@ -297,14 +297,14 @@ matchToJS span match =
297297clauseToJS span var (Clause value vars e) = do
298298 let vars' = map (\n -> var ++ "._" ++ show n) [0..]
299299 s <- matchToJS span $ matchSubst (zip vars vars') e
300− return $ concat [ "\ncase ", case value of
301− Right (Boolean True) -> "true"
302− Right (Boolean False) -> "false"
303− Right lit -> show lit
304− Left name -> quoted $ case List.elemIndices '.' name of
305− [] -> name
306− is -> drop (last is + 1) name
307− , ":", indent s ]
300+ pattern <- case value of
301+ Right (Boolean True) -> return "true"
302+ Right (Boolean False) -> return "false"
303+ Right lit -> toJS lit
304+ Left name -> return . quoted $ case List.elemIndices '.' name of
305+ [] -> name
306+ is -> drop (last is + 1) name
307+ return $ concat [ "\ncase ", pattern, ":", indent s ]
308308
309309jsNil = "_L.Nil"
310310jsCons e1 e2 = "_L.Cons(" ++ e1 ++ "," ++ e2 ++ ")"
compiler/Parse/Type.hs+1−1
@@ -64,7 +64,7 @@ expr :: IParser T.Type
6464expr =
6565 do t1 <- app <|> term
6666 whitespace
67− arr <- optionMaybe arrow
67+ arr <- optionMaybe (try arrow)
6868 whitespace
6969 case arr of
7070 Just _ -> T.Lambda t1 <$> expr
runtime/Render/Element.js+2−2
@@ -252,9 +252,9 @@ function updateProps(node, curr, next) {
252252 e.style.opacity = props.opacity;
253253 }
254254 var nextColor = (props.color.ctor === 'Just' ?
255− extract(props.color._0) : 'transparent');
255+ extract(props.color._0) : '');
256256 if (e.style.backgroundColor !== nextColor) {
257− e.style.backgroundColor = nextColor;
257+ e.style.backgroundColor = (nextColor === '' ? 'transparent' : nextColor);
258258 }
259259 if (props.tag !== currP.tag) { e.id = props.tag; }
260260 if (props.href !== currP.href) {
runtime/Render/Utils.js+2−2
@@ -14,8 +14,8 @@ function addTo(container, elem) {
1414}
1515
1616function extract(c) {
17− if (c._3 === 1) { return 'rgb(' + c._0 + ',' + c._1 + ',' + c._2 + ')'; }
18− return 'rgba(' + c._0 + ',' + c._1 + ',' + c._2 + ',' + c._3 + ')';
17+ if (c._3 === 1) { return 'rgb(' + c._0 + ', ' + c._1 + ', ' + c._2 + ')'; }
18+ return 'rgba(' + c._0 + ', ' + c._1 + ', ' + c._2 + ', ' + c._3 + ')';
1919}
2020
2121function addTransform(style, trans) {
tests/Main.hs+16−3
@@ -1,9 +1,22 @@
11module Main where
22
3−import Test.Framework
3+import System.Directory
4+import System.Exit (exitWith)
5+import System.Environment (getArgs)
6+import Test.Framework.TestManager
47import Test.Framework.BlackBoxTest
58
69main :: IO ()
7−main = htfMain tests
10+main = do
11+ args <- getArgs
12+ tests <- blackBoxTests "tests/good" "dist/build/elm/elm" ".elm" bbtArgs
13+ code <- runTestWithArgs args tests
14+ removeDirectoryRecursive "cache"
15+ removeDirectoryRecursive "build"
16+ exitWith code
817
9−tests = blackBoxTests "tests/good" "dist/build/elm/elm" ".elm" defaultBBTArgs
18+bbtArgs = defaultBBTArgs { bbtArgs_stdoutDiff = ignoreDiff
19+ , bbtArgs_stderrDiff = ignoreDiff }
20+
21+ignoreDiff :: Diff
22+ignoreDiff _ _ = return Nothing
tests/testdeleted−7
@@ -1,7 +0,0 @@
1−#!/bin/sh
2−(
3− cd `dirname $0` &&
4− cabal configure --enable-tests &&
5− cabal build &&
6− cabal test
7−) || exit 1
tests/testRepldeleted−5
@@ -1,5 +0,0 @@
1−#!/bin/sh
2−
3−here=`cd \`dirname $0\` && pwd`
4−cd "$here/tests" &&
5−ghci
tests/tests/.ghcideleted−5
@@ -1,5 +0,0 @@
1−:set -i../src -i.
2−:l Main Parse.Parser
3−:m + Test.QuickCheck Main
4−:set prompt "test>> "
5−:set -Wall