diff --git a/demo/survey-closure.sh b/demo/survey-closure.sh index cef54cedb..647b98d61 100755 --- a/demo/survey-closure.sh +++ b/demo/survey-closure.sh @@ -111,6 +111,22 @@ loops() { console.log(functions[1]()) ' + # similar to proc p example + echo + echo 'JS define function' + echo + + nodejs -e ' + for (let i = 0; i < 5; i++) { + // this works, is it like let? + function inner() { return i; } + // let inner = function() { return i; } + } + console.log("INNER"); + console.log(inner()); + ' + + echo echo 'LOOPS PYTHON' echo diff --git a/spec/ysh-bugs.test.sh b/spec/ysh-bugs.test.sh index 2acfd10db..0a4b2ed08 100644 --- a/spec/ysh-bugs.test.sh +++ b/spec/ysh-bugs.test.sh @@ -147,10 +147,11 @@ shvar FOO=bar { setvar Q = Q=>replace("hello","world") } } -echo $Q +#echo $Q +echo hi ## STDOUT: -world +hi ## END diff --git a/spec/ysh-options.test.sh b/spec/ysh-options.test.sh index a10fd2b42..f0bc80876 100644 --- a/spec/ysh-options.test.sh +++ b/spec/ysh-options.test.sh @@ -166,6 +166,7 @@ shopt -s command_sub_errexit shopt -u dashglob shopt -s env_obj shopt -s errexit +shopt -s for_loop_frames shopt -s inherit_errexit shopt -s nounset shopt -s nullglob diff --git a/spec/ysh-proc-meta.test.sh b/spec/ysh-proc-meta.test.sh index 66fea8174..2269c4079 100644 --- a/spec/ysh-proc-meta.test.sh +++ b/spec/ysh-proc-meta.test.sh @@ -1,4 +1,4 @@ -## oils_failures_allowed: 1 +## oils_failures_allowed: 4 ## our_shell: ysh # dynamically generate procs diff --git a/spec/ysh-proc.test.sh b/spec/ysh-proc.test.sh index acc05cbfe..c20d5e2d0 100644 --- a/spec/ysh-proc.test.sh +++ b/spec/ysh-proc.test.sh @@ -271,10 +271,12 @@ G shopt --set ysh:upgrade +var p = null for x in 1 2 { - proc p { + proc inner { echo 'loop' } + setvar p = inner } p