Skip to content

Commit e373220

Browse files
committed
update to v2.1.0\nremove failure for valid comment lines
1 parent 603cb75 commit e373220

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [v2.1.0] - 2020-02-12
8+
- remove the sub strip-comment check and fail lines with only the
9+
comment char at the beginning of the line and no other content
10+
- modify tests to check the new behavior
11+
712
## [v2.0.1] - 2019-12-18
813
- add test to ensure tabs are handled properly
914
- note that v2.0.0 was never uploaded to CPAN

META6.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"perl" : "6.*",
33
"name" : "Text::Utils",
4-
"version" : "2.0.1",
4+
"version" : "2.1.0",
55
"api" : "2",
66
"description" : "Provides some additional text functions (replaces module Text::More)",
77
"auth" : "github:tbrowder",

lib/Text/Utils.pm6

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ multi strip-comment($line is copy, #= string of text with possible comment
4545
:$normalize, #= if true, normalize returned strings
4646
:$last, #= if true, use the last instead of first comment char
4747
) is export(:strip-comment) {
48-
# failure condition:
49-
if $line eq $mark {
50-
die "FATAL: The input line is the same as the comment char: '$line'";
51-
}
5248
my $comment = '';
5349
my $clen = $mark.chars;
5450
my $idx = $last ?? rindex $line, $mark
@@ -74,13 +70,6 @@ multi strip-comment($line is copy, #= string of text with possible comment
7470
:$normalize, #= if true, normalize returned strings
7571
:$last, #= if true, use the last instead of first comment char
7672
) is export(:strip-comment) {
77-
# failure condition:
78-
if $line eq $comment-char {
79-
note "FATAL: The input line is the same as the comment char: '$line'";
80-
note " This signature is deprecated.";
81-
note " Use the ':mark<$line>' named param for the comment char.";
82-
die "DEPRECATED SIGNATURE--USE THE MARK NOTATION IN THE FUTURE";
83-
}
8473
my $comment = '';
8574
my $clen = $comment-char.chars;
8675
my $idx = $last ?? rindex $line, $comment-char

t/020-strip-comment.t

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ my (@s, @stripped);
1111
'some text',
1212
'text # coment...',
1313
' #comment',
14-
'more text'
14+
'more text',
15+
'#',
1516
);
1617

1718
@stripped = (
1819
'some text',
1920
'text ',
2021
' ',
21-
'more text'
22+
'more text',
23+
'',
2224
);
2325

2426
# return the stripped strings
@@ -36,7 +38,8 @@ for 0..^+@s -> $i {
3638
'some text',
3739
'text ; coment...',
3840
' ;comment',
39-
'more text'
41+
'more text',
42+
';',
4043
);
4144

4245
# return the stripped strings
@@ -96,16 +99,10 @@ is $comm, ' some comment ';
9699
is $text, 'some text %% text';
97100
is $comm, 'some comment';
98101

99-
# bad input by user
100-
dies-ok { $text = strip-comment '#'; }, 'dies when line is same as comment char';
101-
102102
#===== END OF ORIGINAL SIGNATURE IS DEPRECATED =====
103103

104104
# test the new signature
105105

106-
# bad input by user
107-
dies-ok { $text = strip-comment '%', :mark<%>; }, 'dies when line is same as comment (:mark) char';
108-
109106
($text, $comm) = strip-comment $tstr, :mark<%%>, :last, :save-comment, :normalize;
110107
is $text, 'some text %% text';
111108
is $comm, 'some comment';

0 commit comments

Comments
 (0)