Skip to content

Commit 53b01e3

Browse files
committed
added regular expression check test
1 parent c723c35 commit 53b01e3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/ERegInstantiationCheckTest.hx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package ;
2+
3+
import checkstyle.checks.ERegInstantiationCheck;
4+
5+
class ERegInstantiationCheckTest extends CheckTestCase {
6+
7+
public function testCorrectEReg() {
8+
var msg = checkMessage(ERegInstantiationTests.TEST1, new ERegInstantiationCheck());
9+
assertEquals(msg, 'Bad EReg instantiation, define expression between ~/ and /');
10+
}
11+
12+
public function testWrongEReg() {
13+
var msg = checkMessage(ERegInstantiationTests.TEST2, new ERegInstantiationCheck());
14+
assertEquals(msg, '');
15+
}
16+
}
17+
18+
class ERegInstantiationTests {
19+
public static inline var TEST1:String = "
20+
class Test {
21+
var _reg:EReg = new EReg('test', 'i');
22+
}";
23+
24+
public static inline var TEST2:String =
25+
"class Test {
26+
var _reg:EReg = ~/test/i;
27+
}";
28+
}

0 commit comments

Comments
 (0)