summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java15
-rw-r--r--src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java5
2 files changed, 18 insertions, 2 deletions
diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
index 3c00909..0ee863a 100644
--- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/DocumentMatcherParsingTests.java
@@ -1,8 +1,10 @@
package org.zwobble.mammoth.tests.styles.parsing;
import org.junit.Test;
+import org.zwobble.mammoth.internal.styles.EqualToStringMatcher;
import org.zwobble.mammoth.internal.styles.ParagraphMatcher;
import org.zwobble.mammoth.internal.styles.RunMatcher;
+import org.zwobble.mammoth.internal.styles.StartsWithStringMatcher;
import org.zwobble.mammoth.internal.styles.parsing.DocumentMatcherParser;
import org.zwobble.mammoth.internal.styles.parsing.StyleMappingTokeniser;
import org.zwobble.mammoth.internal.styles.parsing.TokenIterator;
@@ -27,10 +29,19 @@ public class DocumentMatcherParsingTests {
}
@Test
- public void readsParagraphWithStyleName() {
+ public void readsParagraphWithExactStyleName() {
assertThat(
parseParagraphMatcher("p[style-name='Heading 1']"),
- deepEquals(ParagraphMatcher.styleName("Heading 1")));
+ deepEquals(ParagraphMatcher.styleName(new EqualToStringMatcher("Heading 1")))
+ );
+ }
+
+ @Test
+ public void readsParagraphWithStyleNamePrefix() {
+ assertThat(
+ parseParagraphMatcher("p[style-name^='Heading']"),
+ deepEquals(ParagraphMatcher.styleName(new StartsWithStringMatcher("Heading")))
+ );
}
@Test
diff --git a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java
index e4e1f9b..f3147ba 100644
--- a/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java
+++ b/src/test/java/org/zwobble/mammoth/tests/styles/parsing/StyleMappingTokeniserTests.java
@@ -81,6 +81,11 @@ public class StyleMappingTokeniserTests {
}
@Test
+ public void startsWithSymbolsAreTokenised() {
+ assertTokens("^=^=", isToken(TokenType.SYMBOL, "^="), isToken(TokenType.SYMBOL, "^="));
+ }
+
+ @Test
public void openParensAreTokenised() {
assertTokens("((", isToken(TokenType.SYMBOL, "("), isToken(TokenType.SYMBOL, "("));
}