summaryrefslogtreecommitdiff
path: root/t/03readonly.t
diff options
context:
space:
mode:
Diffstat (limited to 't/03readonly.t')
-rw-r--r--t/03readonly.t20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/03readonly.t b/t/03readonly.t
new file mode 100644
index 0000000..57e938a
--- /dev/null
+++ b/t/03readonly.t
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Fatal;
+
+use Struct::Dumb qw( readonly_struct );
+
+readonly_struct Point => [qw( x y )];
+
+my $point = Point(10, 20);
+
+is( $point->x, 10, '$point->x is 10' );
+
+ok( exception { $point->y = 30 },
+ '$point->y throws exception on readonly_struct' );
+
+done_testing;