Skip to content

Commit f671a5b

Browse files
committed
Fix tests for line separator
1 parent e21b017 commit f671a5b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/com/inet/lib/less/LessException.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1010
* copies of the Software, and to permit persons to whom the Software is
1111
* furnished to do so, subject to the following conditions:
12-
*
12+
*
1313
* The above copyright notice and this permission notice shall be included in
1414
* all copies or substantial portions of the Software.
15-
*
15+
*
1616
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1717
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1818
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,7 +27,6 @@
2727
package com.inet.lib.less;
2828

2929
import java.util.ArrayList;
30-
import java.util.Collections;
3130
import java.util.List;
3231

3332
/**
@@ -49,7 +48,7 @@ public class LessException extends RuntimeException {
4948

5049
/**
5150
* Constructs a new runtime exception with the specified cause.
52-
*
51+
*
5352
* @param cause
5453
* the cause
5554
*/
@@ -59,7 +58,7 @@ public class LessException extends RuntimeException {
5958

6059
/**
6160
* Constructs a new runtime exception with the specified detail message and cause.
62-
*
61+
*
6362
* @param message
6463
* the detail message.
6564
* @param cause
@@ -106,7 +105,7 @@ public String getOriginalMessage() {
106105
public String getMessage() {
107106
StringBuilder builder = new StringBuilder( super.getMessage() );
108107
for( LessFilePosition pos : positions ) {
109-
builder.append( "\n\t on line " ).append( pos.getLine() ).append( ", column " ).append( pos.getColumn() );
108+
builder.append( System.lineSeparator() ).append( " on line " ).append( pos.getLine() ).append( ", column " ).append( pos.getColumn() );
110109
if( pos.getFilename() != null ) {
111110
builder.append( ", file " ).append( pos.getFilename() );
112111
}

test/com/inet/lib/less/ErrorTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package com.inet.lib.less;
22

3-
import org.junit.Test;
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.fail;
45

5-
import static org.junit.Assert.*;
6+
import org.junit.Test;
67

78
public class ErrorTest {
89

@@ -12,7 +13,7 @@ private void assertLessException( String less, String expectedErrorMessage ) {
1213
fail( "LessException expected" );
1314
} catch( LessException lex ) {
1415
String message = lex.getMessage();
15-
assertEquals( expectedErrorMessage, message.substring( 0, message.indexOf( '\n' ) ) );
16+
assertEquals( expectedErrorMessage, message.substring( 0, message.indexOf( System.lineSeparator() ) ) );
1617
}
1718
}
1819
@Test

0 commit comments

Comments
 (0)