-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added a bunch of unit tests and fixed the bugs found because of that
- Loading branch information
Showing
13 changed files
with
423 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
source.. = src/,\ | ||
src-gen/ | ||
xtend-gen/ | ||
bin.includes = META-INF/,\ | ||
. |
61 changes: 61 additions & 0 deletions
61
nl.dslmeinte.xtext.less.tests/src/nl/dslmeinte/xtext/less/test/ExamplesTest.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package nl.dslmeinte.xtext.less.test | ||
|
||
import nl.dslmeinte.xtext.less.LessStandaloneSetup | ||
import org.eclipse.emf.ecore.resource.Resource$Diagnostic | ||
import org.eclipse.emf.ecore.util.Diagnostician | ||
import org.eclipse.xtext.junit.AbstractXtextTests | ||
import org.junit.Assert | ||
|
||
class ExamplesTest extends AbstractXtextTests { | ||
|
||
private Diagnostician diagnostician | ||
|
||
override protected setUp() { | ||
super.setUp() | ||
with(typeof(LessStandaloneSetup)); | ||
diagnostician = new Diagnostician() | ||
} | ||
|
||
def void test_all_examples_at_once() { | ||
val path = ^class.^package.name.replace('.', '/') + "/examples.less" | ||
val cssFile = getModelAndExpect(^class.classLoader.getResourceAsStream(path), Integer::MIN_VALUE) // TODO -> UNKNOWN_EXPECTATION | ||
|
||
val resource = cssFile.eResource | ||
|
||
for( e : resource.errors ) { | ||
e.print("error") | ||
} | ||
// resource.errors.map [it.print("error")] | ||
|
||
for( w : resource.warnings ) { | ||
w.print("warning") | ||
} | ||
// resource.warnings.map [println("warning:\t" + it)] | ||
|
||
val issues = diagnostician.validate(cssFile).children | ||
for( i : issues ) { | ||
i.print | ||
} | ||
// issues.map [println("issue:\t" + it)] | ||
if( issues.size > 0 || resource.errors.size > 0 ) { | ||
Assert::fail("there were syntactic errors and/or semantic issues") | ||
} | ||
} | ||
|
||
def private print(Diagnostic it, String type) { | ||
println( '''LÇlineÈÇsafeColumnÈ ÇtypeÈ ÇmessageÈ'''.toString ) | ||
} | ||
|
||
def private print(org.eclipse.emf.common.util.Diagnostic it) { | ||
println( '''ÇseverityÈ ÇmessageÈ'''.toString ) // TODO map severity int -> String | ||
} | ||
|
||
def private safeColumn(Diagnostic it) { | ||
try { | ||
"@" + column | ||
} catch( UnsupportedOperationException e ) { | ||
"" | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.