From 2c30111a109a91fc7fd2d6377f47dd72e2ab33d5 Mon Sep 17 00:00:00 2001 From: Andy Chu Date: Tue, 12 Jan 2021 01:26:43 -0800 Subject: [PATCH] [test/lint] Fix build. Add more test cases for tracing. --- core/dev.py | 3 +-- demo/xtrace1.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/core/dev.py b/core/dev.py index a2e3286d0d..515ae9f917 100644 --- a/core/dev.py +++ b/core/dev.py @@ -8,7 +8,6 @@ lvalue_e, lvalue__Named, lvalue__Indexed, lvalue__Keyed, cmd_value__Assign ) -from _devbuild.gen.option_asdl import builtin_i from _devbuild.gen.syntax_asdl import assign_op_e from asdl import runtime @@ -19,7 +18,7 @@ from osh import word_ from pylib import os_path from mycpp import mylib -from mycpp.mylib import switch, tagswitch, iteritems +from mycpp.mylib import tagswitch, iteritems import posix_ as posix diff --git a/demo/xtrace1.sh b/demo/xtrace1.sh index 40e5df2dd6..8d5e27f90f 100755 --- a/demo/xtrace1.sh +++ b/demo/xtrace1.sh @@ -101,13 +101,14 @@ loop() { for x in 1 \ 2 \ 3; do - echo $x; echo =$(echo {x}-) + echo $x; echo =$(echo {x}-) done i=0 while test $i -lt 3; do echo $x; echo ${x}- i=$((i+1)) + if true; then continue; fi done } @@ -157,4 +158,51 @@ atoms2() { readonly r=4 } +compound() { + set -x + + # Nothing for time + time sleep 0 + + # There is no tracing for () and {} + { echo b1 + echo b2 + } + + ( echo c1 + echo c2 + ) + + # no tracing for if; just the conditions + if test -d /; then + echo yes + else + echo no + fi + + # Hm this causes a concurrency problem. + # I think we want to buffer the line + ls | wc -l | sort + + # There IS tracing for 'case' line + case foo in + fo*) + echo case + ;; + *) + echo default + ;; + esac + + f() { + echo hi + } + +} + +oil_constructs() { + echo TODO + # BareDecl, VarDecl, PlaceMutation, Expr +} + "$@"