From ce3295c5bb1f0a5d6b470a9302aeb63bb05c384f Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Tue, 7 Sep 2021 16:19:56 -0700 Subject: [PATCH] add tests for sub split_pretoken --- t/snippets/expect/pretok.def | 11 +++++++++++ t/snippets/packing_list.txt | 5 +++-- t/snippets/pretok.in | 11 +++++++++++ t/snippets24.t | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 t/snippets/expect/pretok.def create mode 100644 t/snippets/pretok.in diff --git a/t/snippets/expect/pretok.def b/t/snippets/expect/pretok.def new file mode 100644 index 00000000..b210a069 --- /dev/null +++ b/t/snippets/expect/pretok.def @@ -0,0 +1,11 @@ +# test sub split_pretoken +my $bb = $^? ? "defined" : "not defined"; +my $aa = $^ if ($bb); +my $yes = $^O eq "linux"; +my $no = $^O ne "linux"; +my $val = %^O; +$str0 = 'hi' . 's' x 10 if (1); +$str1 = 'merci' x 0.1e4 . $str0; +$str2 = 'hi' . 's' x 10.2 . 'you'; +$str2 = 'hi' . 's' x 0.1e1; +$str3 = 'tak' x 0 if ('bad'); diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 5ea6f4e1..e411f5b4 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -324,6 +324,8 @@ ../snippets24.t rt136417.rt136417 ../snippets24.t numbers.def ../snippets24.t code_skipping.def +../snippets24.t git51.def +../snippets24.t git51.git51 ../snippets3.t ce_wn1.ce_wn ../snippets3.t ce_wn1.def ../snippets3.t colin.colin @@ -464,5 +466,4 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets24.t git51.def -../snippets24.t git51.git51 +../snippets24.t pretok.def diff --git a/t/snippets/pretok.in b/t/snippets/pretok.in new file mode 100644 index 00000000..874712db --- /dev/null +++ b/t/snippets/pretok.in @@ -0,0 +1,11 @@ +# test sub split_pretoken +my $bb=$^??"defined":"not defined"; +my $aa=$^if($bb); +my $yes=$^Oeq"linux"; +my $no=$ ^One"linux"; +my $val=% ^O; +$str0='hi'.'s'x10if(1); +$str1='merci'x0.1e4.$str0; +$str2='hi'.'s'x10.2.'you'; +$str2='hi'.'s'x0.1e1; +$str3='tak'x0if('bad'); diff --git a/t/snippets24.t b/t/snippets24.t index 92aa7089..975caa1d 100644 --- a/t/snippets24.t +++ b/t/snippets24.t @@ -19,6 +19,7 @@ #16 code_skipping.def #17 git51.def #18 git51.git51 +#19 pretok.def # To locate test #13 you can search for its name or the string '#13' @@ -278,6 +279,20 @@ my @vals = ( 0o12_345, # optional 'o' and 'O' added in perl v5.33.5 0O12_345, ); +---------- + + 'pretok' => <<'----------', +# test sub split_pretoken +my $bb=$^??"defined":"not defined"; +my $aa=$^if($bb); +my $yes=$^Oeq"linux"; +my $no=$ ^One"linux"; +my $val=% ^O; +$str0='hi'.'s'x10if(1); +$str1='merci'x0.1e4.$str0; +$str2='hi'.'s'x10.2.'you'; +$str2='hi'.'s'x0.1e1; +$str3='tak'x0if('bad'); ---------- 'rt136417' => <<'----------', @@ -924,6 +939,24 @@ Type::Libraries->setup_class( ); #18........... }, + + 'pretok.def' => { + source => "pretok", + params => "def", + expect => <<'#19...........', +# test sub split_pretoken +my $bb = $^? ? "defined" : "not defined"; +my $aa = $^ if ($bb); +my $yes = $^O eq "linux"; +my $no = $^O ne "linux"; +my $val = %^O; +$str0 = 'hi' . 's' x 10 if (1); +$str1 = 'merci' x 0.1e4 . $str0; +$str2 = 'hi' . 's' x 10.2 . 'you'; +$str2 = 'hi' . 's' x 0.1e1; +$str3 = 'tak' x 0 if ('bad'); +#19........... + }, }; my $ntests = 0 + keys %{$rtests}; -- 2.39.5