Skip to content

Commit 9fa354b

Browse files
authored
split off test dir (#360)
1 parent f8706aa commit 9fa354b

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

ci/all_tests.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ if [ -z "${ROC}" ]; then
1919
exit 1
2020
fi
2121

22+
TESTS_DIR="${EXAMPLES_DIR/\/examples\//\/tests\/}"
23+
export TESTS_DIR
24+
2225
if [ "$NO_BUILD" != "1" ]; then
2326
# May be needed for breaking roc changes. Also replace platform in build.roc with `cli: platform "platform/main.roc",`
2427
./jump-start.sh
@@ -31,6 +34,9 @@ fi
3134
for roc_file in $EXAMPLES_DIR*.roc; do
3235
$ROC check $roc_file
3336
done
37+
for roc_file in $TESTS_DIR*.roc; do
38+
$ROC check $roc_file
39+
done
3440

3541
# roc build
3642
architecture=$(uname -m)
@@ -45,6 +51,9 @@ for roc_file in $EXAMPLES_DIR*.roc; do
4551
fi
4652

4753
done
54+
for roc_file in $TESTS_DIR*.roc; do
55+
$ROC build $roc_file $ROC_BUILD_FLAGS
56+
done
4857

4958
# prep for next step
5059
cd ci/rust_http_server
@@ -75,6 +84,13 @@ for roc_file in $EXAMPLES_DIR*.roc; do
7584

7685
expect ci/expect_scripts/$no_ext_name.exp
7786
done
87+
for roc_file in $TESTS_DIR*.roc; do
88+
89+
roc_file_only="$(basename "$roc_file")"
90+
no_ext_name=${roc_file_only%.*}
91+
92+
expect ci/expect_scripts/$no_ext_name.exp
93+
done
7894

7995
# remove Dir example directorys if they exist
8096
rm -rf dirExampleE
@@ -105,8 +121,6 @@ for roc_file in $EXAMPLES_DIR*.roc; do
105121
DB_PATH=${EXAMPLES_DIR}todos.db $ROC dev $roc_file $ROC_BUILD_FLAGS
106122
elif [ "$base_file" == "sqlite-everything.roc" ]; then
107123
DB_PATH=${EXAMPLES_DIR}todos2.db $ROC dev $roc_file $ROC_BUILD_FLAGS
108-
elif [ "$base_file" == "sqlite-test.roc" ]; then
109-
DB_PATH=${EXAMPLES_DIR}test.db $ROC dev $roc_file $ROC_BUILD_FLAGS
110124
elif [ "$base_file" == "temp-dir.roc" ]; then
111125
$ROC dev $roc_file $ROC_BUILD_FLAGS --linker=legacy
112126
elif [ "$base_file" == "file-accessed-modified-created-time.roc" ] && [ "$IS_MUSL" == "1" ]; then
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ set timeout 7
77

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

10-
set env(DB_PATH) $env(EXAMPLES_DIR)test.db
10+
set env(DB_PATH) $env(TESTS_DIR)test.db
1111

12-
spawn $env(EXAMPLES_DIR)sqlite-test
12+
spawn $env(TESTS_DIR)sqlite
1313

1414
expect -exact "Rows: {col_bytes: \[72, 101, 108, 108, 111\], col_f32: 78.9, col_f64: 123.456, col_i16: 1234, col_i32: 123456, col_i8: 123, col_nullable_bytes: (NotNull \[119, 111, 114, 108, 100\]), col_nullable_f32: (NotNull 12.34), col_nullable_f64: (NotNull 456.789), col_nullable_i16: (NotNull 5678), col_nullable_i32: (NotNull 456789), col_nullable_i64: (NotNull 987654321), col_nullable_i8: (NotNull 56), col_nullable_str: (NotNull \"nullable text\"), col_nullable_u16: (NotNull 8765), col_nullable_u32: (NotNull 987654), col_nullable_u64: (NotNull 123456789), col_nullable_u8: (NotNull 78), col_text: \"example text\", col_u16: 4321, col_u32: 654321, col_u8: 234}\r\n{col_bytes: \[119, 111, 114, 108, 100\], col_f32: 23.45, col_f64: 456.789, col_i16: 5678, col_i32: 789012, col_i8: 45, col_nullable_bytes: Null, col_nullable_f32: (NotNull 67.89), col_nullable_f64: Null, col_nullable_i16: Null, col_nullable_i32: (NotNull 123456), col_nullable_i64: Null, col_nullable_i8: Null, col_nullable_str: Null, col_nullable_u16: Null, col_nullable_u32: (NotNull 654321), col_nullable_u64: Null, col_nullable_u8: Null, col_text: \"sample text\", col_u16: 9876, col_u32: 1234567, col_u8: 123}\r\n" {
1515
expect "Row count: 2\r\n" {

tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sqlite

tests/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Currently most things are tested in the examples folder, if something does not fit well as an example we put it here.
Binary file not shown.

0 commit comments

Comments
 (0)