diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py')
-rw-r--r-- | packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py b/packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py index 59e0f0b84f69..3d4df307d1b0 100644 --- a/packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py +++ b/packages/Python/lldbsuite/test/expression_command/persistent_types/TestPersistentTypes.py @@ -5,13 +5,14 @@ Test that lldb persistent types works correctly. from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class PersistenttypesTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -29,31 +30,57 @@ class PersistenttypesTestCase(TestBase): self.runCmd("expression struct $foo { int a; int b; };") - self.expect("expression struct $foo $my_foo; $my_foo.a = 2; $my_foo.b = 3;", - startstr = "(int) $0 = 3") + self.expect( + "expression struct $foo $my_foo; $my_foo.a = 2; $my_foo.b = 3;", + startstr="(int) $0 = 3") self.expect("expression $my_foo", - substrs = ['a = 2', 'b = 3']) + substrs=['a = 2', 'b = 3']) self.runCmd("expression typedef int $bar") self.expect("expression $bar i = 5; i", - startstr = "($bar) $1 = 5") + startstr="($bar) $1 = 5") - self.runCmd("expression struct $foobar { char a; char b; char c; char d; };") + self.runCmd( + "expression struct $foobar { char a; char b; char c; char d; };") self.runCmd("next") - self.expect("memory read foo -t $foobar", - substrs = ['($foobar) 0x', ' = ', "a = 'H'","b = 'e'","c = 'l'","d = 'l'"]) # persistent types are OK to use for memory read - - self.expect("memory read foo -t foobar", - substrs = ['($foobar) 0x', ' = ', "a = 'H'","b = 'e'","c = 'l'","d = 'l'"],matching=False,error=True) # the type name is $foobar, make sure we settle for nothing less + self.expect( + "memory read foo -t $foobar", + substrs=[ + '($foobar) 0x', + ' = ', + "a = 'H'", + "b = 'e'", + "c = 'l'", + "d = 'l'"]) # persistent types are OK to use for memory read + + self.expect( + "memory read foo -t foobar", + substrs=[ + '($foobar) 0x', + ' = ', + "a = 'H'", + "b = 'e'", + "c = 'l'", + "d = 'l'"], + matching=False, + error=True) # the type name is $foobar, make sure we settle for nothing less self.expect("expression struct { int a; int b; } x = { 2, 3 }; x", - substrs = ['a = 2', 'b = 3']) - - self.expect("expression struct { int x; int y; int z; } object; object.y = 1; object.z = 3; object.x = 2; object", - substrs = ['x = 2', 'y = 1', 'z = 3']) - - self.expect("expression struct A { int x; int y; }; struct { struct A a; int z; } object; object.a.y = 1; object.z = 3; object.a.x = 2; object", - substrs = ['x = 2', 'y = 1', 'z = 3']) + substrs=['a = 2', 'b = 3']) + + self.expect( + "expression struct { int x; int y; int z; } object; object.y = 1; object.z = 3; object.x = 2; object", + substrs=[ + 'x = 2', + 'y = 1', + 'z = 3']) + + self.expect( + "expression struct A { int x; int y; }; struct { struct A a; int z; } object; object.a.y = 1; object.z = 3; object.a.x = 2; object", + substrs=[ + 'x = 2', + 'y = 1', + 'z = 3']) |