Skip to content
Permalink
Browse files
Use a ':' after the line number in warnings to match MRI.
  • Loading branch information
nirvdrum committed Jan 16, 2015
1 parent acda7f1 commit 83f055ad0161ee80f3cd67733838c78c9c5caea7
@@ -81,7 +81,7 @@ public void warn(ID id, String fileName, int lineNumber, String message) {

StringBuilder buffer = new StringBuilder(100);

buffer.append(fileName).append(':').append(lineNumber).append(' ');
buffer.append(fileName).append(':').append(lineNumber).append(": ");
buffer.append("warning: ").append(message).append('\n');
IRubyObject errorStream = runtime.getGlobalVariables().get("$stderr");
errorStream.callMethod(runtime.getCurrentContext(), "write", runtime.newString(buffer.toString()));
@@ -1421,7 +1421,7 @@ public void testSetErrorWriter() {
esw = new StringWriter();
instance.setErrorWriter(esw);
instance.runScriptlet("ABC=10;ABC=20");
String expResult = "<script>:1 warning: already initialized constant ABC";
String expResult = "<script>:1: warning: already initialized constant ABC";
assertEquals(expResult, esw.toString().trim());

instance.getVarMap().clear();
@@ -3,7 +3,7 @@

describe "JRuby warnings" do
specify "have the correct line number" do
warning = "(eval):1 warning: already initialized constant GH1446\n"
warning = "(eval):1: warning: already initialized constant GH1446\n"
expect($stderr).to receive(:write).with(warning)
eval "GH1446=0;GH1446=1"
end

0 comments on commit 83f055a

Please sign in to comment.