]> git.vpit.fr Git - perl/modules/re-engine-Plugin.git/blobdiff - t/20-methods/minlen/bytes.t
Order the test subdirectories
[perl/modules/re-engine-Plugin.git] / t / 20-methods / minlen / bytes.t
diff --git a/t/20-methods/minlen/bytes.t b/t/20-methods/minlen/bytes.t
new file mode 100644 (file)
index 0000000..643f118
--- /dev/null
@@ -0,0 +1,23 @@
+=pod
+
+C<minlen> speaks bytes, not characters.
+
+=cut
+
+use strict;
+use Test::More tests => 3;
+use re::engine::Plugin (
+    comp => sub { shift->minlen(5) },
+    exec => sub {
+        my ($re, $str) = @_;
+        pass "Called with $str";
+    },
+);
+
+my $str = "ævar";
+is(length $str, 5, "$str is 5 char long"); # Chars
+$str =~ /pattern/; # no ->exec
+
+chop $str;
+is(length $str, 4, "$str is 4 char long"); # Chars
+$str =~ /pattern/; # yes ->exec