Skip to content

Commit

Permalink
feat(objectionary#2147): move move FuncXslTest under ParsingTrainTest
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Jun 15, 2023
1 parent f5685da commit cabc43d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 69 deletions.
69 changes: 0 additions & 69 deletions eo-parser/src/test/java/org/eolang/parser/FuncXslTest.java

This file was deleted.

31 changes: 31 additions & 0 deletions eo-parser/src/test/java/org/eolang/parser/ParsingTrainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@
package org.eolang.parser;

import com.jcabi.matchers.XhtmlMatchers;
import com.jcabi.xml.ClasspathSources;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import com.jcabi.xml.XSLDocument;
import com.yegor256.xsline.Xsline;
import org.cactoos.io.InputStreamOf;
import org.cactoos.io.ResourceOf;
import org.eolang.jucs.ClasspathSource;
import org.eolang.xax.XaxStory;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

/**
* Test case for {@link ParsingTrain}.
Expand Down Expand Up @@ -78,6 +83,32 @@ void stopsPipeline() {
);
}

/**
* Test for {@see _func.xsl}.
*
* @since 1.0
*/
@ParameterizedTest
@CsvSource({
"00 , 0",
"0000 , 0",
"000000 , 0",
"000001 , 1",
"000010 , 16",
"000100 , 256",
"FFFFFF , 16777215"
})
void runsXslFunction(final String bytes, final String num) {
MatcherAssert.assertThat(
new Xsline(
new ParsingTrain("/org/eolang/parser/apply-func.xsl")
).pass(new XMLDocument(String.format("<o>%s</o>", bytes))),
XhtmlMatchers.hasXPath(
String.format("/o[text()='%s']", num)
)
);
}

@ParameterizedTest
@ClasspathSource(value = "org/eolang/parser/packs/", glob = "**.yaml")
void parsesPacks(final String pack) throws Exception {
Expand Down

0 comments on commit cabc43d

Please sign in to comment.