Skip to content

Commit

Permalink
Merge pull request #24 from JRI98/fix_nightly
Browse files Browse the repository at this point in the history
Adapt to Str/List split rename
  • Loading branch information
Anton-4 authored Nov 22, 2024
2 parents d7cd800 + 537a714 commit 327ae1c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 20 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: get latest roc nightly
- id: try_fetching_testing_release
continue-on-error: true
run: |
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-TESTING.tar.gz
- name: There are no TESTING releases, checking regular releases instead
if: steps.try_fetching_testing_release.outcome == 'failure'
run: |
curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- name: rename nightly tar
run: mv $(ls | grep "roc_nightly.*tar\.gz") roc_nightly.tar.gz

Expand All @@ -33,4 +39,4 @@ jobs:
- run: ./roc_nightly/roc version

# Run all tests
- run: ROC=./roc_nightly/roc ./ci/all_tests.sh
- run: ROC=./roc_nightly/roc ./ci/all_tests.sh
6 changes: 3 additions & 3 deletions examples/csv-movies.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
parser: "../package/main.roc",
}

Expand Down Expand Up @@ -50,7 +50,7 @@ movieInfoParser =

actorsParser =
CSV.string
|> P.map \val -> Str.split val ","
|> P.map \val -> Str.splitOn val ","

movieInfoExplanation = \@MovieInfo { title, releaseYear, actors } ->
enumeratedActors = enumerate actors
Expand All @@ -60,7 +60,7 @@ movieInfoExplanation = \@MovieInfo { title, releaseYear, actors } ->

enumerate : List Str -> Str
enumerate = \elements ->
{ before: inits, others: last } = List.split elements (List.len elements - 1)
{ before: inits, others: last } = List.splitAt elements (List.len elements - 1)

last
|> List.prepend (inits |> Str.joinWith ", ")
Expand Down
2 changes: 1 addition & 1 deletion examples/letters.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
parser: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/markdown.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
parser: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/numbers.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
parser: "../package/main.roc",
}

Expand Down
6 changes: 3 additions & 3 deletions examples/xml-svg.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
html: "https://github.com/Hasnep/roc-html/releases/download/v0.6.0/IOyNfA4U_bCVBihrs95US9Tf5PGAWh3qvrBN4DRbK5c.tar.br",
parser: "../package/main.roc",
}
Expand Down Expand Up @@ -35,8 +35,8 @@ main =

svgConvertedToHtml =
String.parseStr Xml.xmlParser svgInput
|> Result.map \xml -> htmlToRocDSL (svgToHtml xml.root) "" 0
|> Task.fromResult!
|> Result.map \xml -> htmlToRocDSL (svgToHtml xml.root) "" 0
|> Task.fromResult!

if svgConvertedToHtml == expectedHtml then
Stdout.line! "Successfully converted SVG into HTML DSL"
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package/String.roc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ parseUtf8Partial = \parser, input ->
codeunitSatisfies : (U8 -> Bool) -> Parser Utf8 U8
codeunitSatisfies = \check ->
Parser.buildPrimitiveParser \input ->
{ before: start, others: inputRest } = List.split input 1
{ before: start, others: inputRest } = List.splitAt input 1

when List.get start 0 is
Err OutOfBounds ->
Expand Down Expand Up @@ -132,7 +132,7 @@ utf8 = \expectedString ->
# Implemented manually instead of a sequence of codeunits
# because of efficiency and better error messages
Parser.buildPrimitiveParser \input ->
{ before: start, others: inputRest } = List.split input (List.len expectedString)
{ before: start, others: inputRest } = List.splitAt input (List.len expectedString)

if start == expectedString then
Ok { val: expectedString, input: inputRest }
Expand Down

0 comments on commit 327ae1c

Please sign in to comment.