Skip to content

Commit

Permalink
test: prefixed name can be more than just letters
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Jul 25, 2019
1 parent 8e02931 commit a2f1181
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ terminal URI:
'<' ( '\\' . /* 'b'|'t'|'n'|'f'|'r'|'u'|'"'|"'"|'\\' */ | !('\\'|'>') )* '>'
;
terminal PREFIX: ID ':';
terminal QNAME: PREFIX ID;
terminal QNAME: PREFIX (INT | ID | '/' | '%')+;
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import org.eclipse.xtext.testing.validation.ValidationTestHelper
import org.junit.jupiter.api.^extension.ExtendWith
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
import org.junit.jupiter.api.Test
import static org.assertj.core.api.Assertions.*
import app.hypermedia.testing.dsl.tests.TestHelpers
import app.hypermedia.testing.dsl.core.ClassBlock

@ExtendWith(InjectionExtension)
@InjectWith(HydraInjectorProvider)
Expand Down Expand Up @@ -48,4 +52,22 @@ class ClassParsingTest {
// then
result.assertNoIssues()
}

@Test
def void prefixedName_termCanContainNonLetterCharacters() {
// when
val result = '''
PREFIX ex: <http://example.com/>
With Class ex:123/foo%20bar {
}
'''.parse

// then
TestHelpers.assertModelParsedSuccessfully(result)

val classBlock = result.steps.get(0) as ClassBlock
assertThat(classBlock.name.value).isEqualTo('ex:123/foo%20bar')
}
}

0 comments on commit a2f1181

Please sign in to comment.