js/src/gdb/tests/test-prettyprinters.py

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 import mozilla.prettyprinters
michael@0 2
michael@0 3 run_fragment('prettyprinters.implemented_types')
michael@0 4
michael@0 5 def implemented_type_names(expr):
michael@0 6 v = gdb.parse_and_eval(expr)
michael@0 7 it = mozilla.prettyprinters.implemented_types(v.type)
michael@0 8 return [str(_) for _ in it]
michael@0 9
michael@0 10 assert_eq(implemented_type_names('i'), ['int'])
michael@0 11 assert_eq(implemented_type_names('a'), ['A', 'int'])
michael@0 12 assert_eq(implemented_type_names('b'), ['B', 'A', 'int'])
michael@0 13 assert_eq(implemented_type_names('c'), ['C'])
michael@0 14 assert_eq(implemented_type_names('c_'), ['C_', 'C'])
michael@0 15 assert_eq(implemented_type_names('e'), ['E', 'C', 'D'])
michael@0 16 assert_eq(implemented_type_names('e_'), ['E_', 'E', 'C', 'D'])
michael@0 17 assert_eq(implemented_type_names('f'), ['F', 'C', 'D'])
michael@0 18 assert_eq(implemented_type_names('h'), ['H', 'F', 'G', 'C', 'D'])
michael@0 19
michael@0 20 # Check that our pretty-printers aren't interfering with printing other types.
michael@0 21 assert_pretty('10', '10')
michael@0 22 assert_pretty('(void*) 0', '') # Because of 'set print address off'

mercurial