Line | |
---|
1 | |
---|
2 | package org.modelica.mdt.test; |
---|
3 | |
---|
4 | import org.modelica.mdt.internal.core.ModelicaElement; |
---|
5 | |
---|
6 | import junit.framework.TestCase; |
---|
7 | |
---|
8 | public class TestModelicaElement extends TestCase |
---|
9 | { |
---|
10 | public void testIsLegalIdentifierName() |
---|
11 | { |
---|
12 | String[] legalIdentifiers = {"_", "abc", "_abc", "_000", "p00_2", |
---|
13 | "'abc'", "'\\\\'", "'!323%%\"'", |
---|
14 | "'!\"#$%&\\'()*+,-./:;<=>?@[\\\\]^_`{|}~'"}; |
---|
15 | String[] illegalIdentifiers = {"012a", "åäö", "'\\'", "'''", "'\n'"}; |
---|
16 | for(String s: legalIdentifiers) |
---|
17 | { |
---|
18 | assertTrue("Legal identifier rejected ("+s+")", |
---|
19 | ModelicaElement.isLegalIdentifierName(s)); |
---|
20 | } |
---|
21 | for(String s: illegalIdentifiers) |
---|
22 | { |
---|
23 | assertFalse("Illegal identifier accepted ("+s+")", |
---|
24 | ModelicaElement.isLegalIdentifierName(s)); |
---|
25 | } |
---|
26 | } |
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.