🎨 elm-format root

This commit is contained in:
Richard Feldman
2016-08-21 06:18:33 -07:00
parent b5e7011d2b
commit 640be1a638
11 changed files with 23 additions and 161 deletions

View File

@@ -1,15 +0,0 @@
module Main where
import Signal exposing (Signal)
import ElmTest exposing (consoleRunner)
import Console exposing (IO, run)
import Task
import Tests
console : IO ()
console = consoleRunner Tests.all
port runner : Signal (Task.Task x ())
port runner = run console

View File

@@ -1,35 +0,0 @@
module Tests (..) where
import ElmTest exposing (..)
import ElmHub exposing (responseDecoder)
import Json.Decode exposing (decodeString)
all : Test
all =
suite
"Decoding responses from GitHub"
[ test "they can decode empty responses"
<| let
emptyResponse =
"""{ "items": [] }"""
in
assertEqual
(decodeString responseDecoder emptyResponse)
(Ok [])
, test "they can decode responses with results in them"
<| let
response =
"""{ "items": [
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
] }"""
in
assertEqual
(decodeString responseDecoder response)
(Ok
[ { id = 5, name = "foo", stars = 42 }
, { id = 3, name = "bar", stars = 77 }
]
)
]

View File

@@ -1,18 +0,0 @@
{
"version": "1.0.0",
"summary": "Like GitHub, but for Elm stuff.",
"repository": "https://github.com/rtfeldman/elm-workshop.git",
"license": "BSD-3-Clause",
"source-directories": [
".",
".."
],
"exposed-modules": [],
"dependencies": {
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
}

View File

@@ -1,14 +1,14 @@
module ElmHub.Css (..) where module ElmHub.Css exposing (..)
import Css exposing (..) import Css exposing (..)
css = css =
stylesheet stylesheet
[ ((.) "content") [ ((.) "content")
[ width (px 960) [ width (px 960)
, margin2 zero auto , margin2 zero auto
, padding (px 30) , padding (px 30)
, fontFamilies [ "Helvetica", "Arial", "serif" ] , fontFamilies [ "Helvetica", "Arial", "serif" ]
]
] ]
]

View File

@@ -1,4 +1,4 @@
module Stylesheets (..) where module Stylesheets exposing (..)
import Css.File exposing (..) import Css.File exposing (..)
import ElmHub.Css import ElmHub.Css
@@ -6,5 +6,5 @@ import ElmHub.Css
port files : CssFileStructure port files : CssFileStructure
port files = port files =
toFileStructure toFileStructure
[ ( "style.css", compile ElmHub.Css.css ) ] [ ( "style.css", compile ElmHub.Css.css ) ]

View File

@@ -1,15 +0,0 @@
module Main where
import Signal exposing (Signal)
import ElmTest exposing (consoleRunner)
import Console exposing (IO, run)
import Task
import Tests
console : IO ()
console = consoleRunner Tests.all
port runner : Signal (Task.Task x ())
port runner = run console

View File

@@ -1,35 +0,0 @@
module Tests (..) where
import ElmTest exposing (..)
import ElmHub exposing (responseDecoder)
import Json.Decode exposing (decodeString)
all : Test
all =
suite
"Decoding responses from GitHub"
[ test "they can decode empty responses"
<| let
emptyResponse =
"""{ "items": [] }"""
in
assertEqual
(decodeString responseDecoder emptyResponse)
(Ok [])
, test "they can decode responses with results in them"
<| let
response =
"""{ "items": [
{ "id": 5, "full_name": "foo", "stargazers_count": 42 },
{ "id": 3, "full_name": "bar", "stargazers_count": 77 }
] }"""
in
assertEqual
(decodeString responseDecoder response)
(Ok
[ { id = 5, name = "foo", stars = 42 }
, { id = 3, name = "bar", stars = 77 }
]
)
]

View File

@@ -1,19 +0,0 @@
{
"version": "1.0.0",
"summary": "Like GitHub, but for Elm stuff.",
"repository": "https://github.com/rtfeldman/elm-workshop.git",
"license": "BSD-3-Clause",
"source-directories": [
".",
".."
],
"exposed-modules": [],
"dependencies": {
"NoRedInk/elm-decode-pipeline": "1.1.2 <= v < 2.0.0",
"elm-lang/core": "4.0.1 <= v < 5.0.0",
"elm-lang/html": "1.0.0 <= v < 2.0.0",
"rtfeldman/elm-css": "1.0.0 <= v < 2.0.0",
"evancz/elm-http": "3.0.1 <= v < 4.0.0"
},
"elm-version": "0.17.0 <= v < 0.18.0"
}

View File

@@ -98,7 +98,6 @@ update msg model =
model model
main : Program Never main : Program Never
main = main =
Html.beginnerProgram Html.beginnerProgram

View File

@@ -11,8 +11,8 @@ import String
all : Test all : Test
all = all =
describe "GitHub Response Decoder" describe "GitHub Response Decoder"
[ test "it results in an Err for invalid JSON" [ test "it results in an Err for invalid JSON" <|
<| \() -> \() ->
let let
json = json =
"""{ "pizza": [] }""" """{ "pizza": [] }"""
@@ -28,8 +28,8 @@ all =
|> decodeString responseDecoder |> decodeString responseDecoder
|> isErrorResult |> isErrorResult
|> Expect.true "Expected decoding an invalid response to return an Err." |> Expect.true "Expected decoding an invalid response to return an Err."
, test "it successfully decodes a valid response" , test "it successfully decodes a valid response" <|
<| \() -> \() ->
"""{ "items": [ """{ "items": [
/* TODO: put JSON here! */ /* TODO: put JSON here! */
] }""" ] }"""
@@ -40,8 +40,8 @@ all =
, { id = 3, name = "bar", stars = 77 } , { id = 3, name = "bar", stars = 77 }
] ]
) )
, test "it decodes one SearchResult for each 'item' in the JSON" , test "it decodes one SearchResult for each 'item' in the JSON" <|
<| \() -> \() ->
let let
-- TODO convert this to a fuzz test that generates a random -- TODO convert this to a fuzz test that generates a random
-- list of ids instead of this hardcoded list of three ids. -- list of ids instead of this hardcoded list of three ids.

View File

@@ -11,8 +11,8 @@ import String
all : Test all : Test
all = all =
describe "GitHub Response Decoder" describe "GitHub Response Decoder"
[ test "it results in an Err for invalid JSON" [ test "it results in an Err for invalid JSON" <|
<| \() -> \() ->
let let
json = json =
"""{ "pizza": [] }""" """{ "pizza": [] }"""
@@ -28,8 +28,8 @@ all =
|> decodeString responseDecoder |> decodeString responseDecoder
|> isErrorResult |> isErrorResult
|> Expect.true "Expected decoding an invalid response to return an Err." |> Expect.true "Expected decoding an invalid response to return an Err."
, test "it successfully decodes a valid response" , test "it successfully decodes a valid response" <|
<| \() -> \() ->
"""{ "items": [ """{ "items": [
/* TODO: put JSON here! */ /* TODO: put JSON here! */
] }""" ] }"""
@@ -40,8 +40,8 @@ all =
, { id = 3, name = "bar", stars = 77 } , { id = 3, name = "bar", stars = 77 }
] ]
) )
, test "it decodes one SearchResult for each 'item' in the JSON" , test "it decodes one SearchResult for each 'item' in the JSON" <|
<| \() -> \() ->
let let
-- TODO convert this to a fuzz test that generates a random -- TODO convert this to a fuzz test that generates a random
-- list of ids instead of this hardcoded list of three ids. -- list of ids instead of this hardcoded list of three ids.