Skip to content

Commit

Permalink
Added a new test for BlockNode position info when wrapping BEGINs.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Dec 5, 2014
1 parent 3e4e479 commit f96b667
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ public void testAtStartOfFile() {
//assertEquals(2, position.getLength());
}

public void testBlockNodeWrappingBegin() {
final DetailedSourcePosition position = detailedSource(find(parse("BEGIN { p 'yo' };\n"), BlockNode.class));
assertEquals("test", position.getFile());

// Since the BlockNode is just a wrapper, it should have the same position as the PreExe19Node representing BEGIN.
assertEquals(0, position.getLine());
assertEquals(0, position.getOffset());
assertEquals(5, position.getLength());
}

public void testAtEndOfFile() {
final DetailedSourcePosition position = detailedSource(find(parse(" 14"), FixnumNode.class));
assertEquals("test", position.getFile());
Expand Down

0 comments on commit f96b667

Please sign in to comment.