Test dumping studied scalars.
authorNicholas Clark <nick@ccl4.org>
Mon, 23 May 2011 20:18:51 +0000 (21:18 +0100)
committerNicholas Clark <nick@ccl4.org>
Sat, 11 Jun 2011 07:32:41 +0000 (09:32 +0200)
ext/Devel-Peek/t/Peek.t

index 4fee5e7..ec54405 100644 (file)
@@ -778,7 +778,10 @@ SKIP: {
      or diag $@;
 }
 
-use constant perl => 'rules';
+use constant {
+    perl => 'rules',
+    beer => 'foamy',
+};
 
 unless ($Config{useithreads}) {
     # These end up as copies in pads under ithreads, which rather defeats the
@@ -814,6 +817,31 @@ unless ($Config{useithreads}) {
   PREVIOUS = 1
   USEFUL = 100
 ');
+
+    do_test('regular string constant', beer,
+'SV = PV\\($ADDR\\) at $ADDR
+  REFCNT = 4
+  FLAGS = \\(PADMY,POK,READONLY,pPOK\\)
+  PV = $ADDR "foamy"\\\0
+  CUR = 5
+  LEN = \d+
+');
+
+    is(study beer, 1, "Our studies were successful");
+
+    do_test('string constant now studied', beer,
+'SV = PVMG\\($ADDR\\) at $ADDR
+  REFCNT = 5
+  FLAGS = \\(PADMY,SMG,POK,READONLY,pPOK,SCREAM\\)
+  IV = 0
+  NV = 0
+  PV = $ADDR "foamy"\\\0
+  CUR = 5
+  LEN = \d+
+  MAGIC = $ADDR
+    MG_VIRTUAL = &PL_vtbl_mglob
+    MG_TYPE = PERL_MAGIC_regex_global\\(g\\)
+');
 }
 
 done_testing();