-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.sh
executable file
·47 lines (43 loc) · 1.21 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
function run_test_json {
pushd test-projects/$1
rm -rf target
RUSTFLAGS="-Z save-analysis" cargo +nightly check
popd
cargo run test-projects/$1/target/debug/deps/save-analysis/binary_thing-*.json > test-projects/$1/target/$1.stdout
output=$(cat test-projects/$1/target/$1.stdout)
expected=$(cat test-projects/$1/$1.stdout)
if [ "$expected" != "$output" ]; then
echo "Mismatch. Expected:"
echo "---------------------"
echo "$expected"
echo "---------------------"
echo "But got:"
echo "---------------------"
echo "$output"
echo "---------------------"
exit 1
fi
}
function run_test_scip {
pushd test-projects/$1
rm -rf target
rust-analyzer scip . --output target/index.scip
popd
cargo run test-projects/$1/target/index.scip > test-projects/$1/target/$1.stdout
output=$(cat test-projects/$1/target/$1.stdout)
expected=$(cat test-projects/$1/$1.stdout)
if [ "$expected" != "$output" ]; then
echo "Mismatch. Expected:"
echo "---------------------"
echo "$expected"
echo "---------------------"
echo "But got:"
echo "---------------------"
echo "$output"
echo "---------------------"
#exit 1 # TODO turn this back on
fi
}
run_test_scip test01
run_test_scip test02