Skip to content

Commit

Permalink
Merge pull request #40 from pmisteliac/master
Browse files Browse the repository at this point in the history
Add Documentation for SPT Extension
  • Loading branch information
Virtlink committed Nov 13, 2020
2 parents 1390e74 + 82f9821 commit 414711f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions source/langdev/meta/lang/spt/test-expectations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,26 @@ They will parse and analyze the fragment and run a given Stratego strategy (with

``Expectation.Run = <run <STRATEGY>>``
This expectation will lookup the given strategy name and run it on the AST node in the test's fragment. If the fragment contains multiple nodes (e.g., it's a list of Statements but some Statements were in the test fixture) the strategy will be run on each of these nodes. Either until it completes successfully, or until it failed on all these nodes. Note that it wil **not** be executed on the nodes in the test fixture, if there was one.

``Expectation.RunWithArgs = <run <STRATEGY>(|<TermArgs>)>``
This expectation will run a strategy that expects term arguments. String literals, integer literals and selection references are permitted as term arguments.::

test rename variable without type [[
let
var msg := "Hello World"
in
print([[msg]])
end
]] run rename(|#1, "message", 0) to [[
let
var message := "Hello World"
in
print(message)
end
]]
``Expectation.RunFails = <run <STRATEGY> fails>``
This expectation checks if the given strategy fails.

``Expectation.RunOn = <run <STRATEGY> on #<INT>>``
This expectation does the same as ``Run``, except it runs the strategy on the nodes at the given selection instead of the nodes of the test's fragment.
Expand Down
4 changes: 4 additions & 0 deletions source/release/note/vnext.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ Parser
~~~~~~

The JSGLR2 parser variants now report warnings on ambiguously parsed substrings. This includes ambiguities in lexical and layout syntax that do not result into ``amb`` nodes in the AST.

SDF
~~~~~~
The ``run`` expectation now allows to call strategies with term arguments. It's now also possible to test if a strategy failed.

0 comments on commit 414711f

Please sign in to comment.