SSR: add new invert test to replace removed old one

This commit is contained in:
Bas Leijdekkers
2017-05-02 20:47:50 +02:00
parent f4f8f77442
commit 5c96f13a43
@@ -24,6 +24,7 @@ import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
@@ -227,6 +228,19 @@ public class StringToConstraintsTransformerTest {
assertEquals(".*(?:comment).*", constraint1.getRegExp());
}
@Test
public void testInvert() {
test("'a:[!regexw(a)&&formal(*List)]");
assertEquals("$a$", myOptions.getSearchPattern());
final MatchVariableConstraint constraint = myOptions.getVariableConstraint("a");
assertTrue(constraint.isWholeWordsOnly());
assertEquals("a", constraint.getRegExp());
assertTrue(constraint.isInvertRegExp());
assertTrue(constraint.isFormalArgTypeWithinHierarchy());
assertFalse(constraint.isInvertFormalType());
assertEquals("List", constraint.getNameOfFormalArgType());
}
@Test(expected = MalformedPatternException.class)
public void testAmpersandsExpected() {
test("'a:[regex(a) regex(b)]");