18. Language-Parametric
Testing Language (LPTL)
module my-tests
language mobl
test Cannot assign an integer to a string [[
module Example
module Example
<test input>
function test() {
var s s : String = 1;
var : String = 1;
}}
]] 1 error
24. LPTL Opportunities (5)
setup [[
module Example
imports stuff
Reduced function test() {
[[...]]
boilerplate }
]]
test Cannot assign ... [[
var s : String = 1;
]] 1 error
25. LPTL Opportunities (6)
1 error
2 warnings
/expected here/
parse fails
Wide set of
test conditions complete ... to ...
resolve ... to ...
refactor ... to ...
build ...
run ...
26. Testing Syntax (1)
test Proper declaration [[
var s : String = "a";
]] parse
test Java-like declaration [[
String s = "a";
]] parse fails
27. Testing Syntax (2)
test Proper declaration [[
var s : String = "a";
]] parse to VarDecl("s", _)
test Precedence [[
3+1*2
]] parse to [[
3 + (1 * 2)
]]
28. Testing Error Markers
test Variable declaration [[
var s : String = "a";
]] 0 errors
test Bad variable declaration [[
var s : String = 25;
]] 1 error /wrong type/
29. Testing References
test [[
module Example
function foo() {
bar();
}
function bar() {
}
]] resolve ... to ...
30. Testing References
test [[
module Example
function foo() {
bar();
[[bar]]();
}
function [[bar]]() {
bar() {
}
]] resolve ... to ...
#1 to #2
52. The Spoofax Language
Workbench [OOPSLA 2010]
• Integrated environment for language
definition
• Define syntax, semantics, IDE
• Based on Eclipse
www.spoofax.org
Editor's Notes
\n
Language workbenches combine interactive definition and use of DSLs\n
Scenario: scoping rules!\n
Scenario: scoping rules!\n
\n
\n
\n
\n
\n
not recording intentions, not avoiding regressions\n
\n
\n
\n
Other variations: nested functions, closures, methods, inheritance\n
Other variations: nested functions, closures, methods, inheritance\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
Module system\n GUI Test Runner\n Avoids boilerplate\n Testing conditions for syntax, semantics, IDE\n
\n
\n
Generic language and infrastructure\nspecialized with embedding\n
Generic language and infrastructure\nspecialized with embedding\n- module system\n- parametrization\n- general format for specifying tests\n- and conditions\n
\n
\n
\n
\n
\n
\n
\n
\n
Test will use parser and compare to expectation\n
Test will use parser and compare to expectation\n
Test will use parser and compare to expectation\n
Test will simulate reference resolve and compare to expectation\n
Test will simulate reference resolve and compare to expectation\n
Test will simulate reference resolve and compare to expectation\n
Test will simulate reference resolve and compare to expectation\n
Test will simulate reference resolve and compare to expectation\n