Closed kittaakos closed 7 years ago
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_1a FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:104
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_1b FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:129
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_2 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:147
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_3 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:186
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_4 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:211
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_indentation_5 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:262
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_ML_indentation_2 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:322
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.MultilineStringTest > test_ML_indentation_5 FAILED
[00:02:04] org.junit.ComparisonFailure at MultilineStringTest.java:495
[00:02:04]
[00:02:04] io.typefox.yang.tests.formatter.YangFormatterTest > test_typedef FAILED
[00:02:04] org.junit.ComparisonFailure at YangFormatterTest.java:526
[00:02:04]
[00:02:04] io.typefox.yang.tests.LexerTest > test_Comments FAILED
[00:02:04] org.junit.ComparisonFailure at LexerTest.java:475
[00:02:04]
[00:02:04] io.typefox.yang.tests.LexerTest > testLexer FAILED
[00:02:04] org.junit.ComparisonFailure at LexerTest.java:475
[00:02:04]
[00:02:04] io.typefox.yang.tests.LexerTest > testExpressionString FAILED
[00:02:04] org.junit.ComparisonFailure at LexerTest.java:475
[00:02:04]
[00:02:04] io.typefox.yang.tests.LexerTest > testExpressionSQString FAILED
[00:02:04] org.junit.ComparisonFailure at LexerTest.java:475
[00:02:04]
[00:02:04] io.typefox.yang.tests.linking.SchemaNodeIdentifierLinkingTest > testLocalAugments FAILED
[00:02:04] org.junit.ComparisonFailure at SchemaNodeIdentifierLinkingTest.java:104
[00:02:05]
[00:02:05] io.typefox.yang.tests.YangParsingTest > testParse FAILED
[00:02:05] org.junit.ComparisonFailure at YangParsingTest.java:508
[00:02:05]
[00:02:05] io.typefox.yang.tests.YangParsingTest > testXpath FAILED
[00:02:05] org.junit.ComparisonFailure at YangParsingTest.java:212
[00:02:05]
[00:02:05] 216 tests completed, 16 failed
[00:02:06] :io.typefox.yang:test FAILED
[00:02:06]
[00:02:06] FAILURE: Build failed with an exception.
Patch with the proposed fix. Has to be applied and verified on Unix too:
diff --git a/yang-lsp/io.typefox.yang/src/main/java/io/typefox/yang/formatting2/YangFormatter.xtend b/yang-lsp/io.typefox.yang/src/main/java/io/typefox/yang/formatting2/YangFormatter.xtend
index 4341142..dd9ce46 100644
--- a/yang-lsp/io.typefox.yang/src/main/java/io/typefox/yang/formatting2/YangFormatter.xtend
+++ b/yang-lsp/io.typefox.yang/src/main/java/io/typefox/yang/formatting2/YangFormatter.xtend
@@ -592,7 +592,7 @@
}
def addStringValue(String text, int originalStartColumn) {
- val parts = text.split("\n")
+ val parts = text.split(System.lineSeparator)
if (parts.length === 1) {
last.append(text, Value)
} else {
@@ -643,7 +643,7 @@
}
def addMultiLineComment(String text) {
- var parts = text.split("\n")
+ var parts = text.split(System.lineSeparator)
var first = true
for (part : parts) {
if (first) {
@@ -672,13 +672,13 @@
addMultiLineComment(text)
}
if (SL_COMMENTRule == grammarElement) {
- val text = text.replace("\n", "")
+ val text = text.replace(System.lineSeparator, "")
addSpace()
addSingleLineComment(text)
newLine()
}
if (WSRule == grammarElement) {
- if (text.contains("\n")) {
+ if (text.contains(System.lineSeparator)) {
newLine()
} else {
addSpace()
@@ -702,7 +702,7 @@
}
override toString() {
- val string = lines.join("\n")
+ val string = lines.join(System.lineSeparator)
return string
}
}
diff --git a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/LexerTest.xtend b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/LexerTest.xtend
index ebcbd12..0427dcc 100644
--- a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/LexerTest.xtend
+++ b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/LexerTest.xtend
@@ -202,13 +202,13 @@
l.assertNextToken(RULE_STRING, '212-$556C')
l.assertNextToken(RULE_WS, ' ')
l.assertNextToken(LeftCurlyBracket, '{')
- l.assertNextToken(RULE_WS, '\n ')
+ l.assertNextToken(RULE_WS, System.lineSeparator + ' ')
l.assertNextToken(Path, 'path')
l.assertNextToken(RULE_WS, ' ')
l.assertNextToken(RULE_HIDDEN, '"')
l.assertNextToken(RULE_ID, 'module')
l.assertNextToken(RULE_HIDDEN, '"')
- l.assertNextToken(RULE_WS, '\n')
+ l.assertNextToken(RULE_WS, System.lineSeparator)
l.assertNextToken(RightCurlyBracket, '}')
}
@@ -338,7 +338,7 @@
uses SET-VAL-TABLEMAP;
}
*/''')
- l.assertNextToken(RULE_WS, '\n')
+ l.assertNextToken(RULE_WS, System.lineSeparator)
l.assertNextToken(EOF,null)
}
diff --git a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/YangParsingTest.xtend b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/YangParsingTest.xtend
index 06b7a38..ccbc605 100644
--- a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/YangParsingTest.xtend
+++ b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/YangParsingTest.xtend
@@ -5,6 +5,7 @@
import com.google.inject.Inject
import io.typefox.yang.yang.AbstractModule
+import io.typefox.yang.yang.Path
import org.eclipse.xtext.diagnostics.Diagnostic
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
@@ -15,7 +16,7 @@
import org.junit.runner.RunWith
import static org.junit.Assert.*
-import io.typefox.yang.yang.Path
+import static extension org.eclipse.xtext.util.Strings.toPlatformLineSeparator
@RunWith(XtextRunner)
@InjectWith(YangInjectorProvider)
@@ -88,7 +89,7 @@
ref SchemaNode ref ref: SchemaNode@(unresolved proxy __synthetic0.yang#|5)
}
}
- }'''.toString, EmfFormatter.objToStr((model.substatements.head as Path).reference))
+ }'''.toString, EmfFormatter.objToStr((model.substatements.head as Path).reference).toPlatformLineSeparator)
}
@Test def void testXpath_02() {
@@ -201,7 +202,7 @@
}
]
attr EString name 'example-system'
- }'''.toString, EmfFormatter.objToStr(model))
+ }'''.toString, EmfFormatter.objToStr(model).toPlatformLineSeparator)
}
@Test
diff --git a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/linking/SchemaNodeIdentifierLinkingTest.xtend b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/linking/SchemaNodeIdentifierLinkingTest.xtend
index 8d02575..43bf83d 100644
--- a/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/linking/SchemaNodeIdentifierLinkingTest.xtend
+++ b/yang-lsp/io.typefox.yang/src/test/java/io/typefox/yang/tests/linking/SchemaNodeIdentifierLinkingTest.xtend
@@ -41,7 +41,7 @@
foo.c12
foo.c12.foo.c22
foo.c12.foo.c22.foo.c32
- foo.c12.foo.lm1'''.toString, elements.join("\n"))
+ foo.c12.foo.lm1'''.toString, elements.join(System.lineSeparator))
this.validator.assertNoErrors(m1)
}
Depends on: https://github.com/eclipse/xtext-core/issues/456
The Windows build is still green although the Linux one has test failures. Also, fix the currently failing tests on Linux.