Skip to main content

module analysis::typepal::TestFramework

rascal-0.40.16
typepal-0.14.8

Usage

import analysis::typepal::TestFramework;

Source code

http://github.com/usethesource/typepal/src/analysis/typepal/TestFramework.rsc

Dependencies

import ParseTree;
import IO;
import String;
import Set;
import Map;
import List;
import util::Benchmark;
extend analysis::typepal::Messenger;
extend analysis::typepal::TypePal;

syntax TTL_id

lexical TTL_id = ([A-Z][a-zA-Z0-9]* !>> [a-zA-Z0-9]) \ TTL_Reserved;

syntax TTL_StringCharacter

lexical TTL_StringCharacter
= "\\" [\" \' \< \> \\ b f n r t]
| ![\" \' \< \> \\]
| [\n][\ \t \u00A0 \u1680 \u2000-\u200A \u202F \u205F \u3000]* [\'] // margin
;

syntax TTL_String

lexical TTL_String = "\"" TTL_StringCharacter*  "\"";

syntax TTL_Reserved

keyword TTL_Reserved = "test" | "expect" ;

syntax TTL_Layout

layout TTL_Layout = TTL_WhitespaceAndComment* !>> [\ \t\n\r];

syntax TTL_WhitespaceAndComment

lexical TTL_WhitespaceAndComment 
= [\ \t\n\r]
| @category="Comment" ws2: "@@" ![\n]+ $
| @category="Comment" ws3: "\<@@" (![@] | "@" !>> "@" | "@@" !>> [\>])* "@@\>"
;

syntax TTL

start syntax TTL = ttl: TTL_TestItem* items ;

syntax TTL_Token

lexical TTL_Token 
= ![\]]
| "]" !<< "]" !>> "]"
;

syntax TTL_TestItem

syntax TTL_TestItem
= "test" TTL_id name "[[" TTL_Token* tokens "]]" TTL_Expect expect
;

syntax TTL_Expect

syntax TTL_Expect
= none: ()
| "expect" "{" {TTL_String ","}* messages "}"
;

data Tree

data Tree (loc src = |unknown:///|)

function matches

bool matches(str subject, str pat)

function spinChar

str spinChar(int n)

function runTests

bool runTests(list[loc] suites, type[&T<:Tree] begin, TModel(Tree t) getModel, bool verbose = false, set[str] runOnly = {}, str runName = "")

function extractTests

lrel[&T<:Tree, set[str]] extractTests(list[loc] suites, type[&T<:Tree] begin)

function relocate

&T<:Tree relocate(&T<:Tree t, loc container)

loc relocate(loc parsed_in_container, loc container)