Permalink
Browse files

make sure deep (de-)indents work

  • Loading branch information...
1 parent 3f9b71b commit 4ee499aace9b6110c3dce23bcbb43708b7ddad87 @masak committed Mar 22, 2014
Showing with 16 additions and 1 deletion.
  1. +1 −1 lib/Text/Indented.pm
  2. +15 −0 t/parse-indent.t
@@ -40,7 +40,7 @@ regex line {
increase_indent($new_suite);
}
elsif $new_indent < indent() {
- decrease_indent;
+ decrease_indent until indent() == $new_indent;
}
add_to_current_suite($line);
View
@@ -79,4 +79,19 @@ sub fails_with($input, $ex_type, $message = $ex_type.^name) {
isa_ok $root.items[2], Str, 'and a string';
}
+{
+ my $input = q:to/EOF/;
+ Level 1
+ Level 2
+ Level 3
+ Level 3
+ Level 1 again
+ EOF
+
+ my $root = parse($input);
+
+ is $root.items.elems, 3, 'three things on the top level';
+ is $root.items[1].items[1].items.elems, 2, 'two lines on indent level 3';
+}
+
done;

0 comments on commit 4ee499a

Please sign in to comment.