From e7baecee36a974bdb06ad779b21877eefea8d12d Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Fri, 16 Nov 2018 08:49:16 -0800 Subject: [PATCH] added new vertical alignment test cases --- t/snippets/align21.in | 2 +- t/snippets/align22.in | 3 +++ t/snippets/align23.in | 3 +++ t/snippets/expect/align21.def | 4 ++-- t/snippets/expect/align22.def | 3 +++ t/snippets/expect/align23.def | 3 +++ t/snippets/expect/carat.def | 2 +- t/snippets/packing_list.txt | 4 +++- t/snippets13.t | 40 ++++++++++++++++++++++++++++++++--- t/snippets2.t | 2 +- 10 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 t/snippets/align22.in create mode 100644 t/snippets/align23.in create mode 100644 t/snippets/expect/align22.def create mode 100644 t/snippets/expect/align23.def diff --git a/t/snippets/align21.in b/t/snippets/align21.in index 9a6a33da..7deed5d7 100644 --- a/t/snippets/align21.in +++ b/t/snippets/align21.in @@ -1,3 +1,3 @@ -# do not align these two (large gap) +# two lines with large gap local (@pieces) = split( /\./, $filename, 2 ); local ($just_dir_and_base) = $pieces[0]; diff --git a/t/snippets/align22.in b/t/snippets/align22.in new file mode 100644 index 00000000..4a6346c4 --- /dev/null +++ b/t/snippets/align22.in @@ -0,0 +1,3 @@ +# two equality lines with different patterns to left of equals do not align +$signame{$_} = ++$signal; +$signum[$signal] = $_; diff --git a/t/snippets/align23.in b/t/snippets/align23.in new file mode 100644 index 00000000..c56d0a8b --- /dev/null +++ b/t/snippets/align23.in @@ -0,0 +1,3 @@ +# two equality lines with same pattern on left of equals will align +my $orig = my $format = "^<<<<< ~~\n"; +my $abc = "abc"; diff --git a/t/snippets/expect/align21.def b/t/snippets/expect/align21.def index c817a9d9..7deed5d7 100644 --- a/t/snippets/expect/align21.def +++ b/t/snippets/expect/align21.def @@ -1,3 +1,3 @@ -# do not align these two (large gap) -local (@pieces) = split( /\./, $filename, 2 ); +# two lines with large gap +local (@pieces) = split( /\./, $filename, 2 ); local ($just_dir_and_base) = $pieces[0]; diff --git a/t/snippets/expect/align22.def b/t/snippets/expect/align22.def new file mode 100644 index 00000000..4a6346c4 --- /dev/null +++ b/t/snippets/expect/align22.def @@ -0,0 +1,3 @@ +# two equality lines with different patterns to left of equals do not align +$signame{$_} = ++$signal; +$signum[$signal] = $_; diff --git a/t/snippets/expect/align23.def b/t/snippets/expect/align23.def new file mode 100644 index 00000000..1286193f --- /dev/null +++ b/t/snippets/expect/align23.def @@ -0,0 +1,3 @@ +# two equality lines with same pattern on left of equals will align +my $orig = my $format = "^<<<<< ~~\n"; +my $abc = "abc"; diff --git a/t/snippets/expect/carat.def b/t/snippets/expect/carat.def index 285c4da8..9d02df1e 100644 --- a/t/snippets/expect/carat.def +++ b/t/snippets/expect/carat.def @@ -1,4 +1,4 @@ my $a = ${^WARNING_BITS}; @{^HOWDY_PARDNER} = ( 101, 102 ); -${^W} = 1; +${^W} = 1; $bb[$^]] = "bubba"; diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index cabeeda1..75ab8b24 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -91,6 +91,7 @@ ../snippets13.t break5.def ../snippets13.t align19.def ../snippets13.t align20.def +../snippets13.t align21.def ../snippets2.t angle.def ../snippets2.t arrows1.def ../snippets2.t arrows2.def @@ -251,4 +252,5 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def -../snippets13.t align21.def +../snippets13.t align22.def +../snippets13.t align23.def diff --git a/t/snippets13.t b/t/snippets13.t index 3b30c65b..b731cdde 100644 --- a/t/snippets13.t +++ b/t/snippets13.t @@ -14,6 +14,8 @@ #11 align19.def #12 align20.def #13 align21.def +#14 align22.def +#15 align23.def # To locate test #13 you can search for its name or the string '#13' @@ -109,9 +111,21 @@ $t = 1000000; ---------- 'align21' => <<'----------', -# do not align these two (large gap) +# two lines with large gap local (@pieces) = split( /\./, $filename, 2 ); local ($just_dir_and_base) = $pieces[0]; +---------- + + 'align22' => <<'----------', +# two equality lines with different patterns to left of equals do not align +$signame{$_} = ++$signal; +$signum[$signal] = $_; +---------- + + 'align23' => <<'----------', +# two equality lines with same pattern on left of equals will align +my $orig = my $format = "^<<<<< ~~\n"; +my $abc = "abc"; ---------- 'break5' => <<'----------', @@ -280,11 +294,31 @@ $t = 1000000; source => "align21", params => "def", expect => <<'#13...........', -# do not align these two (large gap) -local (@pieces) = split( /\./, $filename, 2 ); +# two lines with large gap +local (@pieces) = split( /\./, $filename, 2 ); local ($just_dir_and_base) = $pieces[0]; #13........... }, + + 'align22.def' => { + source => "align22", + params => "def", + expect => <<'#14...........', +# two equality lines with different patterns to left of equals do not align +$signame{$_} = ++$signal; +$signum[$signal] = $_; +#14........... + }, + + 'align23.def' => { + source => "align23", + params => "def", + expect => <<'#15...........', +# two equality lines with same pattern on left of equals will align +my $orig = my $format = "^<<<<< ~~\n"; +my $abc = "abc"; +#15........... + }, }; my $ntests = 0 + keys %{$rtests}; diff --git a/t/snippets2.t b/t/snippets2.t index b8bd7ca4..03a62595 100644 --- a/t/snippets2.t +++ b/t/snippets2.t @@ -435,7 +435,7 @@ my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, ); expect => <<'#18...........', my $a = ${^WARNING_BITS}; @{^HOWDY_PARDNER} = ( 101, 102 ); -${^W} = 1; +${^W} = 1; $bb[$^]] = "bubba"; #18........... }, -- 2.39.5