From 5c96f13a4328fa95136187b404db5b04e2d167b1 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Tue, 2 May 2017 15:59:16 +0200 Subject: [PATCH] SSR: add new invert test to replace removed old one --- .../StringToConstraintsTransformerTest.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java b/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java index 424de997d9df..0748262e919a 100644 --- a/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java +++ b/platform/structuralsearch/testSource/com/intellij/structuralsearch/impl/matcher/compiler/StringToConstraintsTransformerTest.java @@ -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)]");