You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Test rules are made to verify that your implementation of SRL is valid.These files contain simple tests to validate the SRL and thecorresponding results. The structure is easy to understand and implement.
Structure of a .rule File
These rules are required to build valid test rules:
All files used for testing must end with the extension.rule and atleast contain one valid assertion along with the SRL query.
The query is defined throughsrl: on the beginning of a line.
All strings that should match are defined throughmatch: on thebeginning of a line.
There can be unlimitedmatch: lines per rule.
Each match must be surrounded by".
All strings that shouldnot match are defined throughno match:on the beginning of a line.
There can be unlimitedno match: lines per rule.
Each match must be surrounded by".
If a capture group is defined, its result can be defined as follows:
The line must begin withcapture for.
Surrounded by", the test string to match must be provided, followed by a:.
If a named group is desired, use the following syntax:name: "result"
If a anonymous group is desired, just supply"result".
Separate multiple captures using,.
If one expression returns multiple matches, supply the same test string in the second line.
The query as well as the expectations must not exceed one line.If required, new lines can be forced using\n. Tabs using\t.
Comments must be on a separate line and start with a#.
Example .rule Files
# This is a sample rule with a named capture groupsrl: capture (letter twice) as "foo"capture for "aa1":- 0: foo: "aa"match: "example"match: "aa2"no match: "a"
# This is a sample rule with an anonymous capture group and multiple resultssrl: capture (digit)capture for "123":- 0: 0: "1"- 1: 0: "2"- 2: 0: "3"capture for "01":- 0: 0: "0"- 1: 0: "1"
About
Test Rules used for verifying the SRL implementation.