summary refs log tree commit diff stats
path: root/tests/untestable/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'tests/untestable/gdb')
-rw-r--r--tests/untestable/gdb/gdb_pretty_printer_test.py5
-rw-r--r--tests/untestable/gdb/gdb_pretty_printer_test_program.nim34
2 files changed, 36 insertions, 3 deletions
diff --git a/tests/untestable/gdb/gdb_pretty_printer_test.py b/tests/untestable/gdb/gdb_pretty_printer_test.py
index 5b34bcb3d..8f0f88e85 100644
--- a/tests/untestable/gdb/gdb_pretty_printer_test.py
+++ b/tests/untestable/gdb/gdb_pretty_printer_test.py
@@ -25,6 +25,7 @@ outputs = [
   'seq(3, 3) = {"one", "two", "three"}',
   'Table(3, 64) = {[4] = "four", [5] = "five", [6] = "six"}',
   'Table(3, 8) = {["two"] = 2, ["three"] = 3, ["one"] = 1}',
+  '{a = 1, b = "some string"}'
 ]
 
 for i, expected in enumerate(outputs):
@@ -32,7 +33,7 @@ for i, expected in enumerate(outputs):
   gdb.flush()
 
   functionSymbol = gdb.selected_frame().block().function
-  assert functionSymbol.line == 21
+  assert functionSymbol.line == 41, str(functionSymbol.line)
 
   if i == 6:
     # myArray is passed as pointer to int to myDebug. I look up myArray up in the stack
@@ -47,6 +48,6 @@ for i, expected in enumerate(outputs):
 
   output = str(raw)
 
-  assert output == expected, output + " != " + expected
+  assert output == expected, "{0} : output: ({1}) != expected: ({2})".format(i, output, expected)
   gdb.write(f"passed\n", gdb.STDLOG)
   gdb.execute("continue")
diff --git a/tests/untestable/gdb/gdb_pretty_printer_test_program.nim b/tests/untestable/gdb/gdb_pretty_printer_test_program.nim
index c376ef89a..d2acdd282 100644
--- a/tests/untestable/gdb/gdb_pretty_printer_test_program.nim
+++ b/tests/untestable/gdb/gdb_pretty_printer_test_program.nim
@@ -14,7 +14,27 @@ type
     moTwo,
     moThree,
     moFoure,
-
+  
+  MyObj = object
+    a*: int
+    b*: string
+  
+  # MyVariant = ref object
+  #   id*: int
+  #   case kind*: MyEnum
+  #   of meOne: mInt*: int
+  #   of meTwo, meThree: discard
+  #   of meFour:
+  #     moInt*: int
+  #     babies*: seq[MyVariant]
+  #   after: float
+
+  # MyIntVariant = ref object
+  #   stuff*: int
+  #   case myKind*: range[0..32766]
+  #   of 0: mFloat*: float
+  #   of 2: mString*: string
+  #   else: mBabies*: seq[MyIntVariant]
 
 var counter = 0
 
@@ -74,6 +94,18 @@ proc testProc(): void =
   var myOtherTable = {"one": 1, "two": 2, "three": 3}.toTable
   myDebug(myOtherTable) #14
 
+  var obj = MyObj(a: 1, b: "some string")
+  myDebug(obj) #15
+
+  # var varObj = MyVariant(id: 13, kind: meFour, moInt: 94,
+  #                        babies: @[MyVariant(id: 18, kind: meOne, mInt: 7, after: 1.0),
+  #                                  MyVariant(id: 21, kind: meThree, after: 2.0)],
+  #                        after: 3.0)
+  # myDebug(varObj) #16
+
+  # var varObjInt = MyIntVariant(stuff: 5, myKind: 2, mString: "this is my sweet string")
+  # myDebug(varObjInt) #17
+
   echo(counter)