Skip to content

Commit

Permalink
objectionary#250: typo fixed and test added
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 16, 2025
1 parent f1cdf23 commit 4063a1f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ SOFTWARE.
<version>6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-matchers</artifactId>
<version>1.8.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/org/eolang/funcs/escape.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="lineno" version="2.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:eo="https://www.eolang.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" id="escape" version="2.0">
<xsl:function name="eo:escape" as="xs:string">
<xsl:param name="text"/>
<xsl:value-of select="concat('&quot;', replace(replace($text, ' ', '⌴'), '&quot;', '\\x22'), '&quot;')"/>
Expand Down
24 changes: 24 additions & 0 deletions src/test/java/org/eolang/lints/LtByXslTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.eolang.lints;

import com.jcabi.matchers.XhtmlMatchers;
import com.jcabi.xml.XMLDocument;
import java.io.IOException;
import java.nio.file.Files;
Expand All @@ -31,6 +32,8 @@
import java.util.Set;
import java.util.stream.Collectors;
import org.cactoos.io.InputOf;
import org.cactoos.text.TextOf;
import org.cactoos.text.UncheckedText;
import org.eolang.jeo.Disassembler;
import org.eolang.jucs.ClasspathSource;
import org.eolang.parser.EoSyntax;
Expand Down Expand Up @@ -176,6 +179,27 @@ void checksFileNaming() throws IOException {
);
}

@Test
void checksIdsInXslStylesheets() throws IOException {
Files.walk(Paths.get("src/main/resources/org/eolang/lints"))
.filter(Files::isRegularFile)
.filter(file -> file.getFileName().toString().endsWith(".xsl"))
.forEach(
path -> MatcherAssert.assertThat(
String.format("@id is wrong in: %s", path),
XhtmlMatchers.xhtml(
new UncheckedText(new TextOf(path)).asString()
),
XhtmlMatchers.hasXPath(
String.format(
"/xsl:stylesheet[@id='%s']",
path.getFileName().toString().replaceAll("\\.xsl$", "")
)
)
)
);
}

@Test
@Timeout(30L)
void checksEmptyObjectOnLargeXmirInReasonableTime(@TempDir final Path tmp) throws IOException {
Expand Down

0 comments on commit 4063a1f

Please sign in to comment.