-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathtest_python.sh
More file actions
executable file
·49 lines (41 loc) · 1.81 KB
/
test_python.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.81 KB
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
48
49
#!/bin/sh
set -eu
tmp_dir=$(mktemp -d -t bosatsupy-XXXXXXXXXX)
cleanup() {
rm -rf "$tmp_dir"
}
trap cleanup EXIT
check_ls_output() {
output="$1"
printf '%s\n' "$output" | grep -Eq '^listing \.$'
printf '%s\n' "$output" | grep -Eq '^\[(file|dir|symlink|other|missing)\] '
printf '%s\n' "$output" | grep -Eq 'test_workspace'
summary_line=$(printf '%s\n' "$output" | sed -n 's/^listed \([0-9][0-9]*\) entries in \([0-9][0-9]*\) ns$/\1 \2/p')
[ -n "$summary_line" ]
reported_count=${summary_line%% *}
listed_count=$(printf '%s\n' "$output" | grep -Ec '^\[(file|dir|symlink|other|missing)\] ')
[ "$reported_count" -eq "$listed_count" ]
}
check_create_mode_output() {
output="$1"
printf '%s\n' "$output" | grep -Eq '^create_mode_test:ok$'
}
./bosatsuj tool transpile \
--input test_workspace/Issue1633.bosatsu \
python --outdir "$tmp_dir"
python3 -m unittest discover "$tmp_dir" -v --pattern "*.py"
./bosatsuj tool transpile \
--input_dir test_workspace \
--input test_workspace/Bosatsu/IO/Error.bosatsu \
--input test_workspace/Bosatsu/Collection/Array.bosatsu \
--input test_workspace/Bosatsu/IO/Core.bosatsu \
--input test_workspace/Bosatsu/IO/Bytes.bosatsu \
--input test_workspace/Bosatsu/IO/Std.bosatsu \
--input test_workspace/Bosatsu/IO/CreateModeMain.bosatsu \
python --outdir "$tmp_dir" \
--externals test_workspace/Prog.bosatsu_externals \
--evaluators test_workspace/Prog.bosatsu_eval
ls_output=$(PYTHONPATH="$tmp_dir:$PWD/test_workspace" python3 -c "import Bosatsu.LsExample as LsExample; import ProgExt; ProgExt.run(LsExample.main)")
check_ls_output "$ls_output"
create_mode_output=$(PYTHONPATH="$tmp_dir:$PWD/test_workspace" python3 -c "import Bosatsu.IO.CreateModeMain as CreateModeMain; import ProgExt; ProgExt.run(CreateModeMain.main)")
check_create_mode_output "$create_mode_output"