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
Rules are tested through a tiny mechanism where rules are executed on source files with annotations describing the expected failures.
For example:
package fixtures
funcfoo(a, b, c, dint) {
a=1.0// ignoreb="ignore"c=2// ignoreprintln("lit", 12) // MATCH /avoid magic numbers like '12', create a named constant for it/ifa==12.50 { // MATCH /avoid magic numbers like '12.50', create a named constant for it/ifb=="lit" {
c="lit"// MATCH /string literal "lit" appears, at least, 3 times, create a named constant for it/
}
fori:=0; i<1; i++ {
println("lit")
}
}
}
The test machinery will check if the rule produced a failure at the line annotated with // MATCH and will also check that the message of the failure matches that of the annotation.
This approach works fine for almost all cases but it has its limitations: only the message attribute of the failure can be checked. We have no mean to check other attributes of the failure (for example, testing the fix for #416 needs to check that a failure has a certain confidence)
It could be interesting to extend the current testing mechanism to allow checking on any failure property
The text was updated successfully, but these errors were encountered:
Rules are tested through a tiny mechanism where rules are executed on source files with annotations describing the expected failures.
For example:
The test machinery will check if the rule produced a failure at the line annotated with
// MATCH
and will also check that the message of the failure matches that of the annotation.This approach works fine for almost all cases but it has its limitations: only the message attribute of the failure can be checked. We have no mean to check other attributes of the failure (for example, testing the fix for #416 needs to check that a failure has a certain confidence)
It could be interesting to extend the current testing mechanism to allow checking on any failure property
The text was updated successfully, but these errors were encountered: