Skip to content

Commit

Permalink
[test] Add ysh-every-string to CI and release.
Browse files Browse the repository at this point in the history
Add more test cases for strings.
  • Loading branch information
Andy C committed Jan 3, 2024
1 parent a0e7ce6 commit 62e0d0e
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 36 deletions.
1 change: 1 addition & 0 deletions devtools/release.sh
Expand Up @@ -229,6 +229,7 @@ readonly -a MORE_TESTS=(
parse-errors runtime-errors
ysh-runtime-errors
ysh-parse-errors
ysh-every-string
arena
osh-usage tools-deps
syscall
Expand Down
2 changes: 2 additions & 0 deletions doc/release-quality.md
Expand Up @@ -59,6 +59,8 @@ This is a supplement to the [main release page](index.html).
runtime errors.
- [ysh-parse-errors](more-tests.wwz/suite-logs/ysh-parse-errors.txt). YSH
parse errors.
- [ysh-every-string](more-tests.wwz/suite-logs/ysh-every-string.txt). String
literal stress test.
- [ysh-large](more-tests.wwz/suite-logs/ysh-large.txt)
- [arena](more-tests.wwz/suite-logs/arena.txt). Test an invariant of the parser.
- [osh-usage](more-tests.wwz/suite-logs/osh-usage.txt). Misc tests of the `osh` binary.
Expand Down
2 changes: 2 additions & 0 deletions soil/worker.sh
Expand Up @@ -92,6 +92,7 @@ parse-errors test/parse-errors.sh soil-run-py -
runtime-errors test/runtime-errors.sh run-all-with-osh -
ysh-runtime-errors test/ysh-runtime-errors.sh soil-run -
ysh-parse-errors test/ysh-parse-errors.sh soil-run-py -
ysh-every-string test/ysh-every-string.sh soil-run-py -
ysh-large ysh/run.sh soil-run -
json-errors data_lang/json-errors.sh soil-run-py -
link-busybox-ash test/spec-bin.sh link-busybox-ash -
Expand Down Expand Up @@ -223,6 +224,7 @@ preprocessed metrics/source-code.sh preprocessed _tmp/metrics/preprocessed
mycpp-examples mycpp/TEST.sh soil-run _test/mycpp-examples.html
parse-errors test/parse-errors.sh soil-run-cpp -
ysh-parse-errors test/ysh-parse-errors.sh soil-run-cpp -
ysh-every-string test/ysh-every-string.sh soil-run-cpp -
ysh-large ysh/run.sh soil-run-cpp -
json-errors data_lang/json-errors.sh soil-run-cpp -
EOF
Expand Down
72 changes: 36 additions & 36 deletions test/ysh-every-string.sh
Expand Up @@ -49,7 +49,7 @@ test-legacy-expr() {
echo $x
# I guess this is useful for refactoring
var x = $'fo\x6f
var x = $'f\u006f\x6f
---'
echo $x
Expand All @@ -76,41 +76,6 @@ EOF
done
}

test-j8() {
### J8 strings are allowed in YSH

#for sh in $OSH $YSH; do
for sh in $YSH; do
$sh <<'EOF'
# Command mode
echo u'fo\u{6f}
---'
echo b'foo
---'
# Leading indent of ---
echo u'''
fo\u{6f}
---
'''
echo b'''
fo\u{6f}
---
'''
# Expression mode
#var x = u'fo\u{6f}
#---'
#echo $x
EOF
done
}

test-raw() {
### r prefix for raw is allowed in YSH

Expand Down Expand Up @@ -161,6 +126,41 @@ EOF
done
}

test-j8() {
### J8 strings are allowed in YSH

#for sh in $OSH $YSH; do
for sh in $YSH; do
$sh <<'EOF'
# Command mode
echo u'fo\u{6f}
---'
echo b'f\u{6f}\y6f
---'
# Leading indent of ---
echo u'''
fo\u{6f}
---
'''
echo b'''
f\u{6f}\y6f
---
'''
# Expression mode
#var x = u'fo\u{6f}
#---'
#echo $x
EOF
done
}

soil-run-py() {
run-test-funcs
}
Expand Down
15 changes: 15 additions & 0 deletions test/ysh-parse-errors.sh
Expand Up @@ -1346,6 +1346,21 @@ hi
hi
''
"

_parse-error "echo r'''
hi
'''bad
"

_parse-error "echo u'''
hi
'''bad
"

_parse-error 'echo """
hi
"""bad
'
}

#
Expand Down

0 comments on commit 62e0d0e

Please sign in to comment.