-
-
Notifications
You must be signed in to change notification settings - Fork 938
Expand file tree
/
Copy pathTestParser.java
More file actions
25 lines (20 loc) · 681 Bytes
/
TestParser.java
File metadata and controls
25 lines (20 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package org.jruby.test;
import org.jruby.exceptions.RaiseException;
public class TestParser extends Base {
public void testWarningLineNumber() throws Exception {
String out;
String script = "def foo; END {}; end";
out = eval(script);
assertTrue(out.indexOf("test:1") != -1);
}
public void testErrorLineNumber() throws Exception {
String script = "String.new 'a \n" +
"p 'b'\n";
try {
eval(script);
fail("should have raised an exception");
} catch (RaiseException re) {
assertTrue(re.toString().indexOf("test:2") != -1);
}
}
}