forked from sebastianbenz/Jnario
-
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.
sebastianbenz#137 Unknown variable within should_be_null => NullPoint…
…erException
- Loading branch information
1 parent
344050a
commit e48f824
Showing
6 changed files
with
716 additions
and
3 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
280 changes: 280 additions & 0 deletions
280
.../org.jnario.tests/doc-gen/org/jnario/spec/tests/unit/validation/LinkerValidationSpec.html
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,280 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Linker validation</title> | ||
<meta name="description" content=""> | ||
<meta name="author" content="Jnario"> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
|
||
<link rel="stylesheet" href="../../../../../../css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="../../../../../../css/bootstrap-responsive.min.css"> | ||
<link rel="stylesheet" href="../../../../../../css/custom.css"> | ||
<link rel="stylesheet" href="../../../../../../css/prettify.css"> | ||
<script type="text/javascript" src="../../../../../../js/prettify.js"></script> | ||
<script type="text/javascript" src="../../../../../../js/lang-jnario.js"></script> | ||
<script type="text/javascript" src="../../../../../../js/jquery.js"></script> | ||
<script type="text/javascript" src="../../../../../../js/bootstrap-tab.js"></script> | ||
</head> | ||
|
||
<body onload="prettyPrint()"> | ||
<div class="container"> | ||
<div class="tabbable"> | ||
<div class="content"> | ||
<div class="page-header notrun"> | ||
<h1>Linker validation</h1> | ||
<ul class="nav nav-tabs pull-right"> | ||
<li class="active"><a href="#spec" data-toggle="tab">Spec</a></li> | ||
<li><a href="#source" data-toggle="tab">Source</a></li> | ||
</ul> | ||
</div> | ||
<div class="row"> | ||
<div class="span12"> | ||
<div class="tab-content"> | ||
<div class="tab-pane active" id="spec"> | ||
<ul><li><p id="No_validation_errors" class="example notrun"><strong>No validation errors</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
1 should not be 2 | ||
} | ||
} | ||
'''.parse.validate.assertNoIssues</pre> | ||
</li><li><p id="Unknown_variable" class="example notrun"><strong>Unknown variable</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
println(abc) | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
)</pre> | ||
</li><li><p id="Unknown_variable_within_should_be_0" class="example notrun"><strong>Unknown variable within should_be_0</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc should be 0 | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
)</pre> | ||
</li><li><p id="Unknown_variable_within_should_be_null_Bug_137" class="example notrun"><strong>Unknown variable within should_be_null [Bug -137]</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc should be null | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
)</pre> | ||
</li><li><p id="Unknown_variable_within_null" class="example notrun"><strong>Unknown variable within => null</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc => null | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
)</pre> | ||
</li><li><p id="Method_call_with_should_be_null" class="example notrun"><strong>Method call with should be null</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
string => null | ||
} | ||
def getString() {""} | ||
} | ||
'''.parse.validate.assertNoIssues</pre> | ||
</li><li><p id="Null_variable_with_should_be_null" class="example notrun"><strong>Null variable with should be null</strong></p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
val withoutType = null | ||
withoutType => null | ||
} | ||
} | ||
'''.parse.validate.assertNoIssues</pre> | ||
</li></ul> | ||
</div> | ||
<div class="tab-pane" id="source"> | ||
<h3>SpecLinkerValidation.spec</h3> | ||
<p> | ||
<pre class="prettyprint lang-spec linenums"> | ||
package org.jnario.spec.tests.unit.validation | ||
|
||
import com.google.inject.Inject | ||
import java.util.List | ||
import org.eclipse.emf.ecore.EObject | ||
import org.eclipse.xtext.junit4.util.ParseHelper | ||
import org.eclipse.xtext.junit4.validation.ValidationTestHelper | ||
import org.eclipse.xtext.validation.Issue | ||
import org.jnario.jnario.test.util.SpecTestCreator | ||
import org.jnario.runner.CreateWith | ||
import org.junit.Assert | ||
|
||
@CreateWith(typeof(SpecTestCreator)) | ||
describe "Linker validation"{ | ||
@Inject extension ParseHelper< EObject > parseHelper | ||
@Inject extension ValidationTestHelper validationTestHelper | ||
|
||
fact "No validation errors"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
1 should not be 2 | ||
} | ||
} | ||
'''.parse.validate.assertNoIssues | ||
} | ||
|
||
fact "Unknown variable"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
println(abc) | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
) | ||
} | ||
|
||
fact "Unknown variable within should_be_0"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc should be 0 | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
) | ||
} | ||
|
||
fact "Unknown variable within should_be_null (Bug #137)"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc should be null | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
) | ||
} | ||
|
||
fact "Unknown variable within => null"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
abc => null | ||
} | ||
} | ||
'''.parse.validate.assertIssues( | ||
"The method or field abc is undefined" | ||
) | ||
} | ||
|
||
fact "Method call with should be null"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
string => null | ||
} | ||
def getString() {""} | ||
} | ||
'''.parse.validate.assertNoIssues | ||
} | ||
|
||
fact "Null variable with should be null"{ | ||
''' | ||
package bootstrap | ||
|
||
describe "something"{ | ||
fact "x" { | ||
val withoutType = null | ||
withoutType => null | ||
} | ||
} | ||
'''.parse.validate.assertNoIssues | ||
} | ||
|
||
def assertNoIssues(List<Issue> issues) { | ||
issues.size => 0 | ||
} | ||
|
||
def assertIssues(List<Issue> issues, String ... parts) { | ||
val sb = new StringBuilder | ||
for (issue : issues.filter[!parts.exists[part| message.contains(part)]]) { | ||
sb.append("- unmatched actual issue: ") | ||
sb.append(issue) | ||
sb.append(System.getProperty("line.separator")) | ||
} | ||
for (part : parts.filter[part | !issues.exists[message.contains(part)]]) { | ||
sb.append("- unmatched expected issue part: ") | ||
sb.append(part) | ||
sb.append(System.getProperty("line.separator")) | ||
} | ||
if (sb.length > 0) { | ||
Assert.fail(''' | ||
Issue mismatch | ||
«sb.toString» | ||
'''); | ||
} | ||
} | ||
|
||
} | ||
</pre> | ||
</p></div> | ||
</div> | ||
</div> | ||
</div> <!-- /row --> | ||
</div> <!-- /content --> | ||
</div> <!-- /tabbable --> | ||
<footer> | ||
<p><small>Generated by <a href="http://www.jnario.org">Jnario</a>.</small></p> | ||
</footer> | ||
</div> <!-- /container --> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.