Skip to content

Commit

Permalink
[spec/assign-extended] Failing test case for shopt -s extdebug
Browse files Browse the repository at this point in the history
and declare -F.  This is used in the OSH stdlib!  To find the functions
in the current file, i.e. for task files.
  • Loading branch information
Andy C committed Jan 5, 2025
1 parent 7b4f24c commit a40c0eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
7 changes: 5 additions & 2 deletions doc/ul-table.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,11 @@ A DOM-based implementation should be much less than 1000 lines.
## Appendix: Real Examples
- Docs
- [Guide to Procs and Funcs]($oils-doc:proc-func.html) has a big `ul-table`.
- [Guide to Procs and Funcs](proc-func.html) has a big `ul-table`.
Source: [doc/proc-func.md]($oils-src)
- Oils Reference
- [Chapter: Word Language](ref/chap-word-lang.html#op-format) has
tables to document `${x@a}`
- Site
- [oils.pub Home Page](/)
- [Blog Index](/blog/)
Expand All @@ -472,7 +475,7 @@ I converted the tables in these September posts to `ul-table`:
- [After 8 Years, Oils Is Still Small and Flexible](https://www.oilshell.org/blog/2024/09/line-counts.html)
- [Garbage Collection Makes YSH Different](https://www.oilshell.org/blog/2024/09/gc.html)
- [A Retrospective on the Oils Project](https://www.oilshell.org/blog/2024/09/retrospective.html)
- [Oils 0.22.0 Announcement](https://www.oilshell.org/blog/2024/06/release-0.22.0.html#data-languages) - table of multi-line string litearls
- [Oils 0.22.0 Announcement](https://www.oilshell.org/blog/2024/06/release-0.22.0.html#data-languages) - table of multi-line string literals
The markup was much shorter and simpler after conversion!
Expand Down
26 changes: 26 additions & 0 deletions spec/assign-extended.test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## compare_shells: bash-4.4 mksh
## oils_failures_allowed: 1


# Extended assignment language, e.g. typeset, declare, arrays, etc.
Expand Down Expand Up @@ -78,6 +79,31 @@ declare -f ek
## N-I mksh stdout-json: ""
## N-I mksh status: 127

#### declare -F with shopt -s extdebug prints more info
case $SH in mksh) exit ;; esac

source $REPO_ROOT/spec/testdata/bash-source-2.sh

shopt -s extdebug

add () { expr 4 + 4; }

declare -F
echo

declare -F add
# in bash-source-2
declare -F g | sed "s;$REPO_ROOT;ROOT;g"

## STDOUT:
declare -f add
declare -f g

add 7 main
g 3 ROOT/spec/testdata/bash-source-2.sh
## END
## N-I mksh stdout-json: ""

#### declare -p var (exit status)
var1() { echo func; } # function names are NOT found.
declare -p var1 var2 >/dev/null
Expand Down

0 comments on commit a40c0eb

Please sign in to comment.