Skip to content

Commit

Permalink
objectionary#1249: It should align inner classes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Jun 27, 2024
1 parent bf1c21f commit 19c3a07
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public final class TranspileMojo extends SafeMojo {
"/org/eolang/maven/pre/package.xsl",
"/org/eolang/maven/pre/tests.xsl",
"/org/eolang/maven/pre/rename-tests-inners.xsl",
"/org/eolang/maven/pre/align-test-classes.xsl",
"/org/eolang/maven/pre/remove-high-level-inner-classes.xsl",
"/org/eolang/maven/pre/attrs.xsl",
"/org/eolang/maven/pre/data.xsl"
).back(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2016-2024 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="attrs" version="2.0">
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="program/objects/class">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<xsl:if test="//meta[head='tests' or head='junit']">
<xsl:for-each select="class//class">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:for-each>
</xsl:if>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2016-2024 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" id="attrs" version="2.0">
<xsl:output encoding="UTF-8" method="xml"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="program/objects/class/class//class">
<xsl:if test="not(//meta[head='tests' or head='junit'])">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ SOFTWARE.
<xsl:text>ω</xsl:text>
<xsl:value-of select="$class/@ancestors"/>
<xsl:value-of select="substring-after($class/@name, concat($class/@parent, '$'))"/>
<xsl:text>-hash-</xsl:text>
<xsl:value-of select="generate-id($class)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$class/@name"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void checksPacks(final String pack) throws IOException {
);
}
MatcherAssert.assertThat(
BinarizeParseTest.TO_ADD_MESSAGE,
"All yaml tests in packs/ should pass",
check.failures(),
Matchers.empty()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ xsls:
- /org/eolang/maven/pre/classes.xsl
- /org/eolang/parser/remove-noise.xsl
- /org/eolang/maven/pre/tests.xsl
- /org/eolang/maven/pre/align-test-classes.xsl
- /org/eolang/maven/pre/remove-high-level-inner-classes.xsl
- /org/eolang/maven/pre/rename-tests-inners.xsl
tests:
- /program/errors[count(*)=0]
- /program[count(//class)=5]
- /program/objects[count(class)=1]
- //class[@name='ω3t0$a0' and @parent='ω2c']
- //o[@base='ω2c' and @name='c']
- /program/objects/class[count(class)=4]
- /program[count(objects/class/class//class)=0]
- //class[starts-with(@name, 'ω3t0$a0-hash-') and starts-with(@parent, 'ω2c-hash-')]
- //o[starts-with(@base, 'ω2c-hash-') and @name='c']
eo: |
+tests
Expand Down
158 changes: 158 additions & 0 deletions eo-runtime/src/test/eo/org/eolang/nesting-tests.eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2024 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.

+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+tests
+package org.eolang
+version 0.0.0

# Nesting test.
[] > nesting-test
[] > aboba-1
[] > aboba-2
[] > aboba-2
true > @

# Nesting blah test.
[] > nesting-blah-test
blah0 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah0
blah1 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah1
blah2 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah2
blah3 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah3
blah4 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah4
blah5 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah5
blah6 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah6
blah7 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah7
blah8 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah8
blah9 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah9
blah10 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah10
blah11 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah11
blah12 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah12
blah13 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah13
blah14 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah14
blah15 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah15
blah16 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah16
blah17 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah17
blah18 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah18
blah19 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah19
blah20 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah20
blah21 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah21
blah22 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah22
blah23 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah23
blah24 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah24
blah25 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah25
blah26 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah26
blah27 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah27
blah28 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah28
blah29 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah29
blah30 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah30
blah31 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah31
blah32 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah32
blah33 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah33
blah34 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah34
blah35 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah35
blah36 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah36
blah37 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah37
blah38 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah38
blah39 > @
# This is the default 64+ symbols comment in front of named abstract object.
[] > blah39
true > @

0 comments on commit 19c3a07

Please sign in to comment.