Skip to content

Commit

Permalink
Merge pull request #295 from molecules/master
Browse files Browse the repository at this point in the history
additional failing heredoc tests
  • Loading branch information
molecules committed Aug 18, 2017
2 parents 9be474c + 5c6661c commit 8ae4660
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion S02-literals/heredocs.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use v6;
use lib <t/spec/packages/>;
use Test;
use Test::Util;
plan 23;
plan 34;

my $foo = "FOO";
my $bar = "BAR";
Expand Down Expand Up @@ -218,3 +218,61 @@ is_run "my \$x = q:to/END/;\ny\n END", {
:out(''),
:err{ not .contains('Actions.nqp') }
}, 'heredoc trimming warnings do not reference guts';

#?rakudo skip 'RT #131927'
{
# Don't change the space in front of any of these, or you'll change the test!

# 4 spaces are present between the beginning of the line and the heredoc body
my @q1 = q:to/END/;
line one
line two
END
is no-r(@q1[0]), "line one\n\tline two\n", 'trim 4 spaces, leave leading tab in line two';
isnt no-r(@q1[0]), "line one\n line two\n", 'should not contain 4 leading spaces at line two.';

# Same exact heredoc body, except it is moved to the right one space
# 5 spaces are present between the beginning of the line and the heredoc body
my @q2 = q:to/END/;
line one
line two
END
is no-r(@q2[0]), "line one\n\tline two\n", 'trim 5 spaces, leave leading tab in line two';
isnt no-r(@q2[0]), "line one\n line two\n", 'should not contain 3 leading spaces in line two.';

# Same heredoc body as the first, except moved to the right two spaces
# 6 spaces are present between the beginning of the line and the heredoc body
my @q3 = q:to/END/;
line one
line two
END
is no-r(@q3[0]), "line one\n\tline two\n", 'trim 6 spaces, leave leading tab in line two';
isnt no-r(@q3[0]), "line one\n line two\n", 'should not contain 2 leading spaces in line two';

# Same heredoc body as the first, except moved to the right three spaces
# 7 spaces are present between the beginning of the line and the heredoc body
my @q4 = q:to/END/;
line one
line two
END
is no-r(@q4[0]), "line one\n\tline two\n", 'trim 7 leading spaces, leave leading tab in line two';
isnt no-r(@q4[0]), "line one\n line two\n", 'should not contain 1 leading space in line two';

# ONLY TEST THAT PASSES
# Same heredoc body as the first, except moved to the right four spaces
# 8 spaces are present between the beginning of the line and the heredoc body
my @q5 = q:to/END/;
line one
line two
END
is no-r(@q5[0]), "line one\n\tline two\n", 'trim 8 leading spaces, leave leading tab in line two';

# Same heredoc body as the first, except moved to the right five spaces
# 9 spaces are present between the beginning of the line and the heredoc body
my @q6 = q:to/END/;
line one
line two
END
is no-r(@q6[0]), "line one\n\tline two\n", 'trim 9 leading spaces, leave leading tab in line two';
isnt no-r(@q6[0]), "line one\n line two\n", 'should not contain 7 leading spaces in line two';
}

0 comments on commit 8ae4660

Please sign in to comment.