Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1249: It should align inner classes in tests #3243

Merged
merged 6 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,45 @@
<?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="align-test-classes" version="2.0">
<!-- Copies all high-level nesting classes inside the main class. -->
levBagryansky marked this conversation as resolved.
Show resolved Hide resolved
<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']">
levBagryansky marked this conversation as resolved.
Show resolved Hide resolved
<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,40 @@
<?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="remove-high-level-inner-classes" version="2.0">
<!-- Removes all high-level nesting classes inside the main class. -->
levBagryansky marked this conversation as resolved.
Show resolved Hide resolved
<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'])">
levBagryansky marked this conversation as resolved.
Show resolved Hide resolved
<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>
levBagryansky marked this conversation as resolved.
Show resolved Hide resolved
<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
124 changes: 124 additions & 0 deletions eo-runtime/src/test/eo/org/eolang/runtime-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,127 @@
2
build 2 > @
9

# 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 > @
Loading