diff --git a/eo-parser/src/test/java/org/eolang/parser/FuncXslTest.java b/eo-parser/src/test/java/org/eolang/parser/FuncXslTest.java deleted file mode 100644 index efdd1dc4d8..0000000000 --- a/eo-parser/src/test/java/org/eolang/parser/FuncXslTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2023 Objectionary.com - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -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 org.cactoos.io.InputStreamOf; -import org.cactoos.io.ResourceOf; -import org.hamcrest.MatcherAssert; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.CsvSource; - -/** - * Test for {@see _func.xsl}. - * - * @since 1.0 - */ -final class FuncXslTest { - - @ParameterizedTest - @CsvSource({ - "00 , 0", - "0000 , 0", - "000000 , 0", - "000001 , 1", - "000010 , 16", - "000100 , 256", - "FFFFFF , 16777215" - }) - void runsXslFunction(final String bytes, final String num) { - final XML output = new XSLDocument( - new InputStreamOf( - new ResourceOf("org/eolang/parser/apply-func.xsl") - ) - ) - .with(new ClasspathSources()) - .transform(new XMLDocument(String.format("%s", bytes))); - MatcherAssert.assertThat( - output, - XhtmlMatchers.hasXPath( - String.format("/o[text()='%s']", num) - ) - ); - } -} diff --git a/eo-parser/src/test/java/org/eolang/parser/ParsingTrainTest.java b/eo-parser/src/test/java/org/eolang/parser/ParsingTrainTest.java index dcc40b6f39..3801db2919 100644 --- a/eo-parser/src/test/java/org/eolang/parser/ParsingTrainTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/ParsingTrainTest.java @@ -24,9 +24,13 @@ 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; @@ -34,6 +38,7 @@ 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}. @@ -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("%s", 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 {