summaryrefslogtreecommitdiff
path: root/t/references.t
diff options
context:
space:
mode:
Diffstat (limited to 't/references.t')
-rw-r--r--t/references.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/references.t b/t/references.t
new file mode 100644
index 0000000..13af48c
--- /dev/null
+++ b/t/references.t
@@ -0,0 +1,48 @@
+use lib 'inc';
+use Test::YAML tests => 10;
+
+no_diff;
+
+run_yaml_tests;
+
+__DATA__
+=== A scalar ref
++++ perl: \ 42
++++ yaml
+--- !!perl/ref
+=: 42
+
+=== A ref to a scalar ref
++++ perl: \\ "yellow"
++++ yaml
+--- !!perl/ref
+=: !!perl/ref
+ =: yellow
+
+=== A ref to a ref to a scalar ref
++++ perl: \\\ 123
++++ yaml
+--- !!perl/ref
+=: !!perl/ref
+ =: !!perl/ref
+ =: 123
+
+=== A blessed container reference
++++ perl
+my $array_ref = [ 1, 3, 5];
+my $container_ref = \ $array_ref;
+bless $container_ref, 'Wax';
++++ yaml
+--- !!perl/ref:Wax
+=:
+ - 1
+ - 3
+ - 5
+
+=== A blessed scalar reference
++++ perl
+my $scalar = "omg";
+my $scalar_ref = \ $scalar;
+bless $scalar_ref, 'Wax';
++++ yaml
+--- !!perl/scalar:Wax omg