Skip to content

Commit

Permalink
Merge branch 'roc-lang:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi authored Nov 8, 2024
2 parents 6e2e34f + 119663b commit 5549eb4
Show file tree
Hide file tree
Showing 266 changed files with 6,349 additions and 2,984 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/basic_cli_build_release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
#pull_request:
# pull_request:
workflow_dispatch:

# this cancels workflows currently in progress if you start a new one
Expand All @@ -11,7 +11,7 @@ env:
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.br
# Make a new basic-cli git tag and set it here before starting this workflow
RELEASE_TAG: 0.14.0
RELEASE_TAG: 0.16.0

jobs:
prepare:
Expand All @@ -34,14 +34,14 @@ jobs:
fi
# get latest nightly releases
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-TESTING.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-TESTING.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-TESTING.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-TESTING.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-latest.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-TESTING.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-TESTING.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-TESTING.tar.gz
#- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_apple_silicon-TESTING.tar.gz

- name: Save roc_nightly archives
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ mod tests {
use std::io::Write;
use tempfile::{tempdir, TempDir};

const FORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
const FORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
import pf.Stdout
import pf.Stdin
Expand All @@ -273,7 +273,7 @@ main =
name = Stdin.line!
Stdout.line! "Hi $(name)!""#;

const UNFORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
const UNFORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/argv0.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
}

import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/combine-tasks.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout

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

import pf.Stdin
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/echo.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdin
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/env.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout
import pf.Stderr
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/fileBROKEN.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout
import pf.File
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/cli/form.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This file contains `form.roc` embedded as a block in Markdown. It lets us test that `roc check` works with Markdown.

```roc
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
import pf.Stdin
import pf.Stdout
Expand All @@ -20,7 +20,7 @@ main =
Excitingly, we can have another block of Roc code as well! (In this case it is the same one...)

```roc
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
import pf.Stdin
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/form.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdin
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/http-get.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Http
import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/ingested-file-bytes-no-ann.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout
import "test-file.txt" as testFile
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/ingested-file-bytes.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout
import "test-file.txt" as testFile : _ # the _ is optional
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/ingested-file.roc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }

import pf.Stdout
import "ingested-file.roc" as ownCode : Str
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/parse-args.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main] {
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br",
pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br",
}

import pf.Stdout
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/cli/parser-letter-counts.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: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5.2/9VrPjwfQQ1QeSL3CfmWr2Pr9DESdDIXy97pwpuq84Ck.tar.br",
}

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

Expand Down
194 changes: 179 additions & 15 deletions crates/cli/tests/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,36 @@ mod cli_run {
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn module_params_different_types() {
test_roc_app(
"crates/cli/tests/module_params",
"different_types.roc",
&["42"],
&[],
&[],
"Write something:\n42\n",
UseValgrind::No,
TestCliCommands::Run,
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn module_params_issue_7116() {
test_roc_app(
"crates/cli/tests/module_params",
"issue_7116.roc",
&[],
&[],
&[],
"",
UseValgrind::No,
TestCliCommands::Run,
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn module_params_multiline_pattern() {
Expand All @@ -941,6 +971,155 @@ mod cli_run {
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn import_in_expect() {
test_roc_expect(
"crates/cli/tests/module_params",
"ImportInExpect.roc",
&[],
indoc!(
r#"
0 failed and 3 passed in <ignored for test> ms.
"#
),
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn effectful_form() {
test_roc_app(
"crates/cli/tests/effectful",
"form.roc",
&["Agus\n", "Zubiaga\n", "27\n"],
&[],
&[],
indoc!(
r#"
What's your first name?
What's your last name?
Hi, Agus Zubiaga!
How old are you?
Nice! You can vote!
Bye! 👋
"#
),
UseValgrind::No,
TestCliCommands::Dev,
);
}

// Other effectful tests are disabled in Linux because of a platform build issue
// The program actually runs fine, but it fails on tests

#[test]
#[cfg_attr(windows, ignore)]
#[cfg_attr(target_os = "linux", ignore)]
fn interactive_effects() {
test_roc_app(
"examples/cli",
"effects.roc",
&["hi there!"],
&[],
&[],
"hi there!\nIt is known\n",
UseValgrind::Yes,
TestCliCommands::Run,
)
}

#[test]
#[cfg_attr(windows, ignore)]
#[cfg_attr(target_os = "linux", ignore)]
fn effectful_hello() {
test_roc_app(
"crates/cli/tests/effectful",
"hello.roc",
&[],
&[],
&[],
indoc!(
r#"
I'm an effect 👻
"#
),
UseValgrind::No,
TestCliCommands::Dev,
);
}

#[test]
#[cfg_attr(windows, ignore)]
#[cfg_attr(target_os = "linux", ignore)]
fn effectful_loops() {
test_roc_app(
"crates/cli/tests/effectful",
"loops.roc",
&[],
&[],
&[],
indoc!(
r#"
Lu
Marce
Joaquin
Chloé
Mati
Pedro
"#
),
UseValgrind::No,
TestCliCommands::Dev,
);
}

#[test]
#[cfg_attr(windows, ignore)]
#[cfg_attr(target_os = "linux", ignore)]
fn effectful_untyped_passed_fx() {
test_roc_app(
"crates/cli/tests/effectful",
"untyped_passed_fx.roc",
&[],
&[],
&[],
indoc!(
r#"
Before hello
Hello, World!
After hello
"#
),
UseValgrind::No,
TestCliCommands::Dev,
);
}

#[test]
#[cfg_attr(windows, ignore)]
#[cfg_attr(target_os = "linux", ignore)]
fn effectful_ignore_result() {
test_roc_app(
"crates/cli/tests/effectful",
"ignore_result.roc",
&[],
&[],
&[],
indoc!(
r#"
I asked for input and I ignored it. Deal with it! 😎
"#
),
UseValgrind::No,
TestCliCommands::Dev,
);
}

#[test]
#[cfg_attr(windows, ignore)]
fn transitive_expects() {
Expand Down Expand Up @@ -1099,21 +1278,6 @@ mod cli_run {
assert_valid_roc_check_status(out.status);
}

#[test]
#[cfg_attr(windows, ignore)]
fn interactive_effects() {
test_roc_app(
"examples/cli",
"effects.roc",
&["hi there!"],
&[],
&[],
"hi there!\nIt is known\n",
UseValgrind::Yes,
TestCliCommands::Run,
)
}

#[test]
#[cfg_attr(windows, ignore)]
// tea = The Elm Architecture
Expand Down
Loading

0 comments on commit 5549eb4

Please sign in to comment.