-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expand Elm Interactive test coverage for deconstruction and List.sortBy
- Loading branch information
Showing
10 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
.../test-and-train/elm-interactive-scenarios-core/deconstruct-pattern/context-app/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/elm-stuff/ |
24 changes: 24 additions & 0 deletions
24
...nt/test-and-train/elm-interactive-scenarios-core/deconstruct-pattern/context-app/elm.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [ | ||
"src" | ||
], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/browser": "1.0.2", | ||
"elm/core": "1.0.5", | ||
"elm/html": "1.0.0" | ||
}, | ||
"indirect": { | ||
"elm/json": "1.1.3", | ||
"elm/time": "1.0.0", | ||
"elm/url": "1.0.0", | ||
"elm/virtual-dom": "1.0.3" | ||
} | ||
}, | ||
"test-dependencies": { | ||
"direct": {}, | ||
"indirect": {} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...d-train/elm-interactive-scenarios-core/deconstruct-pattern/context-app/src/DemoSyntax.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module DemoSyntax exposing (..) | ||
|
||
import Syntax | ||
|
||
|
||
type alias NodeContent = | ||
{ alfa : Int | ||
, beta : String | ||
} | ||
|
||
|
||
demoRange : Syntax.Range | ||
demoRange = | ||
{ start = { row = 1, column = 1 } | ||
, end = { row = 1, column = 2 } | ||
} | ||
|
||
|
||
sumNodeContentAlfa : List (Syntax.Node NodeContent) -> Int | ||
sumNodeContentAlfa nodes = | ||
case nodes of | ||
[] -> | ||
0 | ||
|
||
node :: rest -> | ||
let | ||
(Syntax.Node _ content) = | ||
node | ||
in | ||
content.alfa + sumNodeContentAlfa rest | ||
|
||
|
||
concatNodeContentBeta : List (Syntax.Node NodeContent) -> String | ||
concatNodeContentBeta nodes = | ||
case nodes of | ||
[] -> | ||
"" | ||
|
||
node :: rest -> | ||
let | ||
(Syntax.Node _ content) = | ||
node | ||
in | ||
content.beta ++ "-" ++ concatNodeContentBeta rest |
26 changes: 26 additions & 0 deletions
26
...t-and-train/elm-interactive-scenarios-core/deconstruct-pattern/context-app/src/Syntax.elm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module Syntax exposing (..) | ||
|
||
{-| Some types from <https://github.com/Viir/elm-syntax/tree/f7d9be0a1f346b22dfaa7b55679659874c72714b/src/Elm/Syntax> | ||
-} | ||
|
||
|
||
{-| Base representation for a syntax node in a source file. | ||
-} | ||
type Node a | ||
= Node Range a | ||
|
||
|
||
{-| Source location | ||
-} | ||
type alias Location = | ||
{ row : Int | ||
, column : Int | ||
} | ||
|
||
|
||
{-| Range for a piece of code with a start and end | ||
-} | ||
type alias Range = | ||
{ start : Location | ||
, end : Location | ||
} |
1 change: 1 addition & 0 deletions
1
...and-train/elm-interactive-scenarios-core/deconstruct-pattern/steps/351/expected-value.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"abc-def-" |
12 changes: 12 additions & 0 deletions
12
...est-and-train/elm-interactive-scenarios-core/deconstruct-pattern/steps/351/submission.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
let | ||
syntaxNodes : List (Syntax.Node DemoSyntax.NodeContent) | ||
syntaxNodes = | ||
[ Syntax.Node | ||
{ start = { row = 1, column = 1 }, end = { row = 1, column = 2 } } | ||
{ alfa = 123, beta = "abc" } | ||
, Syntax.Node | ||
{ start = { row = 1, column = 3 }, end = { row = 1, column = 4 } } | ||
{ alfa = 456, beta = "def" } | ||
] | ||
in | ||
DemoSyntax.concatNodeContentBeta syntaxNodes |
1 change: 1 addition & 0 deletions
1
.../test-and-train/elm-interactive-scenarios-core/elm-core-list/steps/631/expected-value.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[-19,-7,5,11] |
1 change: 1 addition & 0 deletions
1
...ment/test-and-train/elm-interactive-scenarios-core/elm-core-list/steps/631/submission.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
List.sortBy identity [ 11, -7, 5, -19 ] |
1 change: 1 addition & 0 deletions
1
.../test-and-train/elm-interactive-scenarios-core/elm-core-list/steps/633/expected-value.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[(1,["c"]),(0,["a","b"])] |
1 change: 1 addition & 0 deletions
1
...ment/test-and-train/elm-interactive-scenarios-core/elm-core-list/steps/633/submission.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
List.sortBy (\( _, dependencies ) -> List.length dependencies) [ (0, ["a","b"]), (1, ["c"]) ] |