Skip to content

Commit 7bc8cf9

Browse files
authored
improved examples (#355)
* improved examples * Fix debug_assert issue
1 parent 0ad25d8 commit 7bc8cf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+330
-500
lines changed

ci/all_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ for roc_file in $EXAMPLES_DIR*.roc; do
8686
base_file=$(basename "$roc_file")
8787

8888
# countdown, echo, form, piping... all require user input or special setup
89-
ignore_list=("countdown.roc" "echo.roc" "form.roc" "piping.roc" "stdin.roc" "args.roc" "http.roc" "env-var.roc" "dup-bytes.roc")
89+
ignore_list=("stdin-basic.roc" "piping.roc" "command-line-args.roc" "http.roc" "env-var.roc" "bytes-stdin-stdout.roc" "error-handling.roc" "tcp-client.roc")
9090

9191
# check if base_file matches something from ignore_list
9292
for file in "${ignore_list[@]}"; do
@@ -101,7 +101,7 @@ for roc_file in $EXAMPLES_DIR*.roc; do
101101
cd $EXAMPLES_DIR
102102
$absolute_roc dev $base_file $ROC_BUILD_FLAGS
103103
cd ..
104-
elif [ "$base_file" == "sqlite.roc" ]; then
104+
elif [ "$base_file" == "sqlite-basic.roc" ]; then
105105
DB_PATH=${EXAMPLES_DIR}todos.db $ROC dev $roc_file $ROC_BUILD_FLAGS
106106
elif [ "$base_file" == "temp-dir.roc" ]; then
107107
$ROC dev $roc_file $ROC_BUILD_FLAGS --linker=legacy
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set timeout 7
77

88
source ./ci/expect_scripts/shared-code.exp
99

10-
spawn $env(EXAMPLES_DIR)dup-bytes
10+
spawn $env(EXAMPLES_DIR)bytes-stdin-stdout
1111

1212
send -- "someinput\r"
1313

@@ -17,5 +17,5 @@ expect "someinput\r\nsomeinput\r\n" {
1717
}
1818
}
1919

20-
puts stderr "\nError: output was different from expected value."
20+
puts stderr "\nExpect failed: output was different from expected value."
2121
exit 1
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
set timeout 7
77

8-
spawn $env(EXAMPLES_DIR)/args foo
8+
spawn $env(EXAMPLES_DIR)/command-line-args foo
99

1010
source ./ci/expect_scripts/shared-code.exp
1111

@@ -16,5 +16,5 @@ expect "received argument: foo\r\n" {
1616
}
1717
}
1818

19-
puts stderr "\nError: output was different from expected value."
19+
puts stderr "\nExpect failed: output was different from expected value."
2020
exit 1

ci/expect_scripts/command.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ source ./ci/expect_scripts/shared-code.exp
1010
spawn $env(EXAMPLES_DIR)command
1111

1212

13-
expect -exact "BAZ=DUCK\r\nFOO=BAR\r\nFOO=BAR\r\nEXEC" {
13+
expect -exact "EXEC\r\nFOO=BAR\r\nBAZ=DUCK\r\nFOO=BAR\r\n" {
1414
expect eof {
1515
check_exit_and_segfault
1616
}
1717
}
1818

19-
puts stderr "\nError: output was different from expected value."
19+
puts stderr "\nExpect failed: output was different from expected value."
2020
exit 1

ci/expect_scripts/countdown.exp

Lines changed: 0 additions & 32 deletions
This file was deleted.

ci/expect_scripts/dir.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ expect "Success!\r\n" {
1515
}
1616
}
1717

18-
puts stderr "\nError: output was different from expected value."
18+
puts stderr "\nExpect failed: output was different from expected value."
1919
exit 1

ci/expect_scripts/echo.exp

Lines changed: 0 additions & 24 deletions
This file was deleted.

ci/expect_scripts/env-var.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ expect "Your favorite editor is nano!\r\n" {
2121
}
2222
}
2323

24-
puts stderr "\nError: output was different from expected value."
24+
puts stderr "\nExpect failed: output was different from expected value."
2525
exit 1
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ set timeout 7
77

88
source ./ci/expect_scripts/shared-code.exp
99

10-
spawn $env(EXAMPLES_DIR)task-list
10+
spawn $env(EXAMPLES_DIR)error-handling
1111

12-
expect "Foo\r\nBar\r\nBaz\r\n" {
12+
expect "NotFound\r\n" {
1313
expect eof {
1414
check_exit_and_segfault
1515
}
1616
}
1717

18-
puts stderr "\nError: output was different from expected value."
19-
exit 1
18+
puts stderr "\nExpect failed: output was different from expected value."
19+
exit 1

ci/expect_scripts/file-accessed-modified-created-time.exp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ expect {
1616
}
1717
}
1818
timeout {
19-
puts stderr "\nError: timed out waiting for expected output."
19+
puts stderr "\nExpect failed: timed out waiting for expected output."
2020
exit 1
2121
}
2222
}
2323

24-
puts stderr "\nError: output was different from expected value."
24+
puts stderr "\nExpect failed: output was different from expected value."
2525
exit 1

0 commit comments

Comments
 (0)