diff options
Diffstat (limited to 'tests/cmdline')
-rw-r--r-- | tests/cmdline/cmd_parsetree.py | 11 | ||||
-rw-r--r-- | tests/cmdline/cmd_parsetree.py.exp | 67 | ||||
-rw-r--r-- | tests/cmdline/repl_autocomplete.py | 10 | ||||
-rw-r--r-- | tests/cmdline/repl_autocomplete.py.exp | 15 |
4 files changed, 103 insertions, 0 deletions
diff --git a/tests/cmdline/cmd_parsetree.py b/tests/cmdline/cmd_parsetree.py new file mode 100644 index 0000000000..5f698eeae3 --- /dev/null +++ b/tests/cmdline/cmd_parsetree.py @@ -0,0 +1,11 @@ +# cmdline: -v -v -v +# test printing of the parse-tree + +for i in (): + pass +a = None +b = 'str' +c = 'a very long str that will not be interned' +d = b'bytes' +e = b'a very long bytes that will not be interned' +f = 123456789012345678901234567890 diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp new file mode 100644 index 0000000000..06fbeadfc8 --- /dev/null +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -0,0 +1,67 @@ +---------------- +[ 4] rule(2) (n=8) + tok(5) +[ 4] rule(78) (n=4) + id(i) +[ 4] rule(131) (n=1) + NULL +[ 5] rule(42) (n=0) + NULL +[ 6] rule(32) (n=2) + id(a) + tok(15) +[ 7] rule(32) (n=2) + id(b) + str(str) +[ 8] rule(32) (n=2) + id(c) +[ 8] literal str(a very long str that will not be interned) +[ 9] rule(32) (n=2) + id(d) + bytes(bytes) +[ 10] rule(32) (n=2) + id(e) +[ 10] literal bytes(a very long bytes that will not be interned) +[ 11] rule(32) (n=2) + id(f) +[ 11] literal \.\+ +---------------- +File cmdline/cmd_parsetree.py, code block '<module>' (descriptor: \.\+, bytecode @\.\+ bytes) +Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): +######## +\.\+5b +arg names: +(N_STATE 2) +(N_EXC_STACK 0) + bc=-1 line=1 + bc=0 line=4 + bc=9 line=5 + bc=12 line=6 + bc=16 line=7 + bc=22 line=8 + bc=27 line=9 + bc=32 line=10 + bc=37 line=11 +00 BUILD_TUPLE 0 +02 GET_ITER +03 FOR_ITER 12 +06 STORE_NAME i +09 JUMP 3 +12 LOAD_CONST_NONE +13 STORE_NAME a +16 LOAD_CONST_STRING 'str' +19 STORE_NAME b +22 LOAD_CONST_OBJ \.\+ +24 STORE_NAME c +27 LOAD_CONST_OBJ \.\+ +29 STORE_NAME d +32 LOAD_CONST_OBJ \.\+ +34 STORE_NAME e +37 LOAD_CONST_OBJ \.\+ +39 STORE_NAME f +42 LOAD_CONST_NONE +43 RETURN_VALUE +mem: total=\\d\+, current=\\d\+, peak=\\d\+ +stack: \\d\+ out of \\d\+ +GC: total: \\d\+, used: \\d\+, free: \\d\+ + No. of 1-blocks: \\d\+, 2-blocks: \\d\+, max blk sz: \\d\+, max free sz: \\d\+ diff --git a/tests/cmdline/repl_autocomplete.py b/tests/cmdline/repl_autocomplete.py new file mode 100644 index 0000000000..a848cab0f6 --- /dev/null +++ b/tests/cmdline/repl_autocomplete.py @@ -0,0 +1,10 @@ +# tests for autocompletion +impo sys +not_exist. +not_exist +x = '123' +1, x.isdi () +i = str +i.lowe ('ABC') +j = None +j. diff --git a/tests/cmdline/repl_autocomplete.py.exp b/tests/cmdline/repl_autocomplete.py.exp new file mode 100644 index 0000000000..dfb998ff6e --- /dev/null +++ b/tests/cmdline/repl_autocomplete.py.exp @@ -0,0 +1,15 @@ +MicroPython \.\+ version +Use \.\+ +>>> # tests for autocompletion +>>> import sys +>>> not_exist.[K[K[K[K[K[K[K[K[K[K +>>> not_exist[K[K[K[K[K[K[K[K[K +>>> x = '123' +>>> 1, x.isdigit() +(1, True) +>>> i = str +>>> i.lower('ABC') +'abc' +>>> j = None +>>> j.[K[K +>>> |