Skip to content
Permalink
Browse files
Added a new test for BlockNode position info when wrapping BEGINs.
  • Loading branch information
nirvdrum committed Dec 5, 2014
1 parent 3e4e479 commit f96b667249fa423f20c6d772836f5cd3ee1ab061
Showing with 10 additions and 0 deletions.
  1. +10 −0 core/src/test/java/org/jruby/parser/DetailedSourcePositionTest.java
@@ -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());

0 comments on commit f96b667

Please sign in to comment.