Skip to content

Commit

Permalink
[test/spec refactor] Move more metadata to spec/*
Browse files Browse the repository at this point in the history
Fix index-tea.md
  • Loading branch information
Andy C committed Aug 13, 2023
1 parent 49a2ea0 commit 751619a
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 28 deletions.
6 changes: 3 additions & 3 deletions doc/ref/index-tea.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ language and eggex (for lexers).
Functions and Data (<a class="group-link" href="tea-help.html#func-data">func-data</a>)
</h2>

```oil-help-topics
```chapter-links-tea
func func inc(p, p2=0; n=0, ...named) { echo 'hi' }
data data Point(x Int, y Int)
enum enum Tree { Leaf(x Int), Node(left Tree, right Tree) }
Expand All @@ -48,7 +48,7 @@ language and eggex (for lexers).
Builtin Data Types (<a class="group-link" href="tea-help.html#types">types</a>)
</h2>

```oil-help-topics
```chapter-links-tea
[Literals] Str r'\' c'\n' "$var" X multiline r""" c'''
X Symbol %foo
Bool True False None
Expand All @@ -73,7 +73,7 @@ language and eggex (for lexers).
Mods / Objects (<a class="group-link" href="tea-help.html#mod">mod</a>)
</h2>

```oil-help-topics
```chapter-links-tea
[Objects] class bundle state and behavior (aka module)
extends inheritance
self pseudo-keyword
Expand Down
3 changes: 3 additions & 0 deletions spec/assoc.test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## compare_shells: bash
## oils_failures_allowed: 3


# NOTE:
# -declare -A is required.
Expand Down
4 changes: 3 additions & 1 deletion spec/builtin-bash.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# builtins specific to bash and OSH
## oils_failures_allowed: 4
## compare_shells: bash


#### help
help
Expand Down
3 changes: 2 additions & 1 deletion spec/builtin-trap-bash.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# builtin-trap-bash.test.sh
## oils_failures_allowed: 1
## compare_shells: bash

# Notes on bash semantics:

Expand Down
3 changes: 2 additions & 1 deletion spec/introspect.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
## compare_shells: bash

# Test call stack introspection. There are a bunch of special variables
# defined here:
#
Expand Down
3 changes: 3 additions & 0 deletions spec/nix-idioms.test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## compare_shells: bash
## oils_failures_allowed: 2

#### var ref to array 'preHooks[@]'
#
# This idiom discussed on
Expand Down
4 changes: 3 additions & 1 deletion spec/nocasematch-match.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#
## compare_shells: bash
## oils_failures_allowed: 3

# Tests nocasematch matching

#### [[ equality matching
Expand Down
3 changes: 2 additions & 1 deletion spec/type-compat.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
## compare_shells: bash

# Tests for bash's type flags on cells. Hopefully we don't have to implement
# this, but it's good to know the behavior.
#
Expand Down
2 changes: 2 additions & 0 deletions spec/var-op-bash.test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## compare_shells: bash

#### Lower Case with , and ,,
x='ABC DEF'
echo ${x,}
Expand Down
3 changes: 2 additions & 1 deletion spec/var-ref.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#
## compare_shells: bash

# Var refs are done with ${!a}
#
# local/declare -n is tested in spec/named-ref.test.sh.
Expand Down
3 changes: 3 additions & 0 deletions spec/vars-bash.test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## oils_failures_allowed: 1
## compare_shells: bash

#### $SHELL set to login shell

sh=$(which $SH)
Expand Down
29 changes: 10 additions & 19 deletions test/spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,17 @@ builtin-trap() {
}

builtin-trap-bash() {
sh-spec spec/builtin-trap-bash.test.sh --oils-failures-allowed 1 \
$BASH $OSH_LIST "$@"
run-file builtin-trap-bash "$@"
}

# Bash implements type -t, but no other shell does. For Nix.
# zsh/mksh/dash don't have the 'help' builtin.
builtin-bash() {
sh-spec spec/builtin-bash.test.sh --oils-failures-allowed 4 \
$BASH $OSH_LIST "$@"
run-file builtin-bash "$@"
}

vars-bash() {
sh-spec spec/vars-bash.test.sh --oils-failures-allowed 1 \
$BASH $OSH_LIST "$@"
run-file vars-bash "$@"
}

vars-special() {
Expand Down Expand Up @@ -349,8 +346,7 @@ posix() {
}

introspect() {
sh-spec spec/introspect.test.sh --oils-failures-allowed 0 \
$BASH $OSH_LIST "$@"
run-file introspect "$@"
}

tilde() {
Expand Down Expand Up @@ -382,8 +378,7 @@ var-op-slice() {
}

var-op-bash() {
sh-spec spec/var-op-bash.test.sh --oils-failures-allowed 5 \
$BASH $OSH_LIST "$@"
run-file var-op-bash "$@"
}

var-op-strip() {
Expand Down Expand Up @@ -464,7 +459,7 @@ array-compat() {
}

type-compat() {
sh-spec spec/type-compat.test.sh $BASH $OSH_LIST "$@"
run-file type-compat "$@"
}

# += is not POSIX and not in dash.
Expand All @@ -474,8 +469,7 @@ append() {

# associative array -- mksh and zsh implement different associative arrays.
assoc() {
sh-spec spec/assoc.test.sh --oils-failures-allowed 3 \
$BASH $OSH_LIST "$@"
run-file assoc "$@"
}

# ZSH also has associative arrays
Expand Down Expand Up @@ -525,15 +519,13 @@ extglob-match() {
}

nocasematch-match() {
sh-spec spec/nocasematch-match.test.sh --oils-failures-allowed 3 \
$BASH $OSH_LIST "$@"
run-file nocasematch-match "$@"
}

# ${!var} syntax -- oil should replace this with associative arrays.
# mksh has completely different behavior for this syntax. Not worth testing.
var-ref() {
sh-spec spec/var-ref.test.sh --oils-failures-allowed 0 \
$BASH $OSH_LIST "$@"
run-file var-ref "$@"
}

# declare / local -n
Expand Down Expand Up @@ -887,8 +879,7 @@ ysh-dev() {
#

nix-idioms() {
sh-spec spec/nix-idioms.test.sh --oils-failures-allowed 2 \
$BASH $OSH_LIST "$@"
run-file nix-idioms "$@"
}

ble-idioms() {
Expand Down

0 comments on commit 751619a

Please sign in to comment.