diff options
| author | Damien George | 2016-12-22 11:26:06 +1100 |
|---|---|---|
| committer | Damien George | 2016-12-22 11:26:06 +1100 |
| commit | cdec7ba30ed6d527c2d007b7fd37413f0c71a1fd (patch) | |
| tree | 8c6e20f1c4d3b19c1587a1d4e025605c7e29bc52 /tests/cmdline | |
| parent | ebb84131788ca1134d0c9cf38fcb1e5162c14bc3 (diff) | |
tests: Add a coverage test for printing the parse-tree.
Diffstat (limited to 'tests/cmdline')
| -rw-r--r-- | tests/cmdline/cmd_parsetree.py | 11 | ||||
| -rw-r--r-- | tests/cmdline/cmd_parsetree.py.exp | 67 |
2 files changed, 78 insertions, 0 deletions
diff --git a/tests/cmdline/cmd_parsetree.py b/tests/cmdline/cmd_parsetree.py new file mode 100644 index 000000000..5f698eeae --- /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 000000000..06fbeadfc --- /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\+ |
