Skip to content

Commit

Permalink
Use a ':' after the line number in warnings to match MRI.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Jan 16, 2015
1 parent acda7f1 commit 83f055a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/common/RubyWarnings.java
Expand Up @@ -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()));
Expand Down
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion spec/regression/GH-1446_line_number_in_warnings_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 83f055a

Please sign in to comment.