Skip to content

Commit 0969e7e

Browse files
authored
Smoketests work on macos (#15)
* Some work * Getting smoketests working on mac * All tests are passing except known failing tests --------- Co-authored-by: Boppy <[email protected]>
1 parent 1549440 commit 0969e7e

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

test/lib.include

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,13 @@ spacetime_publish() {
7171
set -e
7272
return "$RESULT_CODE"
7373
}
74+
75+
fsed() {
76+
if [[ "$OSTYPE" == "darwin"* ]]; then
77+
sed -i.sed_bak "$@"
78+
rm -f rm *.sed_bak
79+
else
80+
sed -i "$@"
81+
fi
82+
}
83+

test/tests/autoinc1.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source "./test/lib.include"
1212
do_test() {
1313
echo "RUNNING TEST FOR VALUE: $1"
1414
create_project
15-
15+
1616
cat > "${PROJECT_PATH}/src/lib.rs" << EOF
1717
use spacetimedb::{println, spacetimedb};
1818
@@ -38,12 +38,12 @@ pub fn say_hello() {
3838
}
3939
EOF
4040

41-
sed -i "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
42-
43-
run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database
41+
fsed "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
42+
43+
run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database -d -s
4444
[ "1" == "$(grep -c "reated new database" "$TEST_OUT")" ]
4545
IDENT="$(grep "reated new database" "$TEST_OUT" | awk 'NF>1{print $NF}')"
46-
46+
4747
run_test cargo run call "$IDENT" add '["Robert", 1]'
4848
run_test cargo run call "$IDENT" add '["Julie", 2]'
4949
run_test cargo run call "$IDENT" add '["Samantha", 3]'

test/tests/autoinc2.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ source "./test/lib.include"
1212
do_test() {
1313
echo "RUNNING TEST FOR VALUE: $1"
1414
create_project
15-
15+
1616
cat > "${PROJECT_PATH}/src/lib.rs" << EOF
1717
use spacetimedb::{println, spacetimedb};
1818
@@ -46,12 +46,12 @@ pub fn say_hello() {
4646
}
4747
EOF
4848

49-
sed -i "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
50-
49+
fsed "s/REPLACE_VALUE/$1/g" "${PROJECT_PATH}/src/lib.rs"
50+
5151
run_test cargo run publish --project-path "$PROJECT_PATH" --clear-database
5252
[ "1" == "$(grep -c "reated new database" "$TEST_OUT")" ]
5353
IDENT="$(grep "reated new database" "$TEST_OUT" | awk 'NF>1{print $NF}')"
54-
54+
5555
run_test cargo run call "$IDENT" update '["Robert", 2]'
5656
run_test cargo run call "$IDENT" add_new '["Success"]'
5757
if run_test cargo run call "$IDENT" add_new '["Failure"]' ; then

0 commit comments

Comments
 (0)