From 1bedabd87023b1b0d4eb31f2d693b80de2e65913 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 14:47:57 +0300 Subject: [PATCH 01/19] feat(#2422): JoinedUnderscore --- .../src/main/java/org/eolang/maven/Place.java | 10 +-- .../eolang/maven/util/JoinedUnderscore.java | 63 +++++++++++++++++++ .../org/eolang/maven/AssembleMojoTest.java | 27 +++----- .../maven/util/JoinedUnderscoreTest.java | 45 +++++++++++++ 4 files changed, 122 insertions(+), 23 deletions(-) create mode 100644 eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java create mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/util/JoinedUnderscoreTest.java diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 9a8b5dc7c7..22272bcdfb 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -27,6 +27,7 @@ import java.nio.file.Path; import org.eolang.maven.name.DelimitedName; import org.eolang.maven.name.ObjectName; +import org.eolang.maven.util.JoinedUnderscore; /** * Make the place for the object. @@ -66,10 +67,11 @@ public Path make(final Path dir, final String ext) { final StringBuilder out = new StringBuilder(); out.append(this.name.title().replace(".", File.separator)); this.name.label().ifPresent( - version -> { - out.append('_'); - out.append(version); - }); + version -> new JoinedUnderscore( + out.append('_').toString(), + out.append(version).toString() + ).asString() + ); if (!ext.isEmpty()) { out.append('.').append(ext); } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java b/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java new file mode 100644 index 0000000000..ed1390d152 --- /dev/null +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java @@ -0,0 +1,63 @@ +/* + * 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.maven.util; + +import org.cactoos.Text; +import org.cactoos.list.ListOf; + +import java.util.List; + +/** + * Text joined with underscore. + * + * @since 0.34.1 + */ +public final class JoinedUnderscore implements Text { + + /** + * Strings to join. + */ + private final List strings; + + /** + * Ctor. + * @param strngs Strings to join + */ + public JoinedUnderscore(final String... strngs) { + this(new ListOf<>(strngs)); + } + + /** + * Ctor. + * @param strngs Strings to join + */ + public JoinedUnderscore(final List strngs) { + this.strings = strngs; + } + + @Override + public String asString() { + return String.join("_", this.strings); + } +} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java index ef9c267f98..597aeb66de 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java @@ -36,6 +36,7 @@ import org.eolang.maven.log.Logs; import org.eolang.maven.objectionary.ObjsDefault; import org.eolang.maven.objectionary.OyRemote; +import org.eolang.maven.util.JoinedUnderscore; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -47,14 +48,6 @@ /** * Test case for {@link AssembleMojo}. * - * @since 0.1 - * @todo #1602:30min Create new object that will join two strings with "_". - * {@link Place} object makes a path for versioned objects using "_" as - * delimiter between name and hash. Here to test stored files after - * {@link AssembleMojo} execution "joinedWithUnderscore" function was - * introduced. So there's a code duplication and an ugly design. Need to - * create a new object that will join two strings with underscore and use it - * here and in {@link Place}. * @todo #1602:30min Make up how to get rid of excessive usage of * {@code ParseMojo.DIR}, {@code ResolveMojo.DIR} and so on. It would be nice * to replace them with corresponding classes, or something similar @@ -157,8 +150,8 @@ void assemblesTogetherWithVersions(@TempDir final Path temp) throws Exception { .execute(AssembleMojo.class) .result(); final String stdout = "**/io/stdout"; - final String fifth = AssembleMojoTest.joinedWithUnderscore(stdout, "17f8929.xmir"); - final String sixth = AssembleMojoTest.joinedWithUnderscore(stdout, "9c93528.xmir"); + final String fifth = new JoinedUnderscore(stdout, "17f8929.xmir").asString(); + final String sixth = new JoinedUnderscore(stdout, "9c93528.xmir").asString(); final String path = "target/%s/org/eolang"; final String parse = String.format(path, ParseMojo.DIR); final String optimize = String.format(path, OptimizeMojo.DIR); @@ -167,7 +160,7 @@ void assemblesTogetherWithVersions(@TempDir final Path temp) throws Exception { final String seq = "**/seq.xmir"; final String string = "**/string.xmir"; final String hash = String.join(".", master.value(), "eo"); - final String[] jars = new String[] { + final String[] jars = { "**/eo-runtime-0.28.5.jar", "**/eo-runtime-0.28.6.jar", }; @@ -194,10 +187,10 @@ void assemblesTogetherWithVersions(@TempDir final Path temp) throws Exception { ), result.get(pull).toAbsolutePath(), new ContainsFiles( - AssembleMojoTest.joinedWithUnderscore(stdout, "17f8929.eo"), - AssembleMojoTest.joinedWithUnderscore(stdout, "9c93528.eo"), - AssembleMojoTest.joinedWithUnderscore("**/seq", hash), - AssembleMojoTest.joinedWithUnderscore("**/string", hash) + new JoinedUnderscore(stdout, "17f8929.eo").asString(), + new JoinedUnderscore(stdout, "9c93528.eo").asString(), + new JoinedUnderscore("**/seq", hash).asString(), + new JoinedUnderscore("**/string", hash).asString() ) ); MatcherAssert.assertThat( @@ -272,8 +265,4 @@ void configuresChildParameters(@TempDir final Path temp) throws IOException { ) ); } - - private static String joinedWithUnderscore(final String first, final String second) { - return String.join("_", first, second); - } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/JoinedUnderscoreTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/JoinedUnderscoreTest.java new file mode 100644 index 0000000000..39a27988e7 --- /dev/null +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/JoinedUnderscoreTest.java @@ -0,0 +1,45 @@ +/* + * 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.maven.util; + +import org.hamcrest.MatcherAssert; +import org.hamcrest.core.IsEqual; +import org.junit.jupiter.api.Test; + +/** + * Test case for {@link JoinedUnderscore}. + * + * @since 0.34.1 + */ +final class JoinedUnderscoreTest { + + @Test + void readsJoinedString() { + MatcherAssert.assertThat( + "Joined string does not match with expected format", + new JoinedUnderscore("first", "second").asString(), + new IsEqual<>("first_second") + ); + } +} From bd4dbaec0010e885940ee70fc88bec1003b51b44 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 18:42:33 +0300 Subject: [PATCH 02/19] feat(#2422): Place out back --- .../src/main/java/org/eolang/maven/Place.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 22272bcdfb..9a8b5dc7c7 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -27,7 +27,6 @@ import java.nio.file.Path; import org.eolang.maven.name.DelimitedName; import org.eolang.maven.name.ObjectName; -import org.eolang.maven.util.JoinedUnderscore; /** * Make the place for the object. @@ -67,11 +66,10 @@ public Path make(final Path dir, final String ext) { final StringBuilder out = new StringBuilder(); out.append(this.name.title().replace(".", File.separator)); this.name.label().ifPresent( - version -> new JoinedUnderscore( - out.append('_').toString(), - out.append(version).toString() - ).asString() - ); + version -> { + out.append('_'); + out.append(version); + }); if (!ext.isEmpty()) { out.append('.').append(ext); } From 860fabb53dfbbd0976b02aed98dd537b887efefa Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 18:54:38 +0300 Subject: [PATCH 03/19] feat(#2422): clean for qulice --- .../src/main/java/org/eolang/maven/util/JoinedUnderscore.java | 3 +-- .../src/test/java/org/eolang/maven/AssembleMojoTest.java | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java b/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java index ed1390d152..11e107ef70 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/util/JoinedUnderscore.java @@ -23,11 +23,10 @@ */ package org.eolang.maven.util; +import java.util.List; import org.cactoos.Text; import org.cactoos.list.ListOf; -import java.util.List; - /** * Text joined with underscore. * diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java index 597aeb66de..a4931c2877 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/AssembleMojoTest.java @@ -61,6 +61,7 @@ * from older repositories are not parsed successfully because of the presence of varargs there. * So we need to make 2-3 releases and then refactor the test with more fresh versions. Don't * forget to remove the puzzle. + * @since 0.1 */ @ExtendWith(WeAreOnline.class) final class AssembleMojoTest { From b2e411cb4e47a8cc210952b026e6525adf2d4b80 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 18:58:52 +0300 Subject: [PATCH 04/19] feat(#2727): trigger --- eo-maven-plugin/src/main/java/org/eolang/maven/Place.java | 1 + 1 file changed, 1 insertion(+) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 9a8b5dc7c7..2ec1385132 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -76,3 +76,4 @@ public Path make(final Path dir, final String ext) { return dir.resolve(out.toString()); } } + From a4403be2014cf4f6f82e0ff04f979223e7a57143 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 18:59:01 +0300 Subject: [PATCH 05/19] feat(#2727): trigger --- eo-maven-plugin/src/main/java/org/eolang/maven/Place.java | 1 - 1 file changed, 1 deletion(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 2ec1385132..9a8b5dc7c7 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -76,4 +76,3 @@ public Path make(final Path dir, final String ext) { return dir.resolve(out.toString()); } } - From 9f9b321b5628cae07807bc670487ee742d15171d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 16:19:26 +0000 Subject: [PATCH 06/19] chore(deps): update dependency com.yegor256:jping to v0.0.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 844d210cff..edbeb2b3e4 100644 --- a/pom.xml +++ b/pom.xml @@ -213,7 +213,7 @@ SOFTWARE. com.yegor256 jping - 0.0.1 + 0.0.2 test From 84fb590e0e142987329aea05f669ef0e1216ac94 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 19:21:25 +0300 Subject: [PATCH 07/19] feat(#2422): disabled test with puzzle --- .../src/test/java/org/eolang/maven/OptimizeMojoTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java index d03b85d97a..36d1231348 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/OptimizeMojoTest.java @@ -43,6 +43,7 @@ import org.hamcrest.io.FileMatchers; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assumptions; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -112,7 +113,12 @@ void optimizesIfExpired(@TempDir final Path temp) throws Exception { * * @param temp Temporary test directory. * @throws Exception if unexpected error happened. + * @todo #2422:60min This test is unstable for now. + * We should resolve issues with unstable failures and only + * then enable the test. + * Also, see this issue. */ + @Disabled @Test void getsAlreadyOptimizedResultsFromCache(@TempDir final Path temp) throws Exception { final TextOf cached = new TextOf( From a8d62b4d23f7277109025e8c5d60c9952720b871 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Tue, 26 Dec 2023 21:22:06 +0300 Subject: [PATCH 08/19] fix(#2729): syntax pack + multithread printing --- .../main/java/org/eolang/maven/PrintMojo.java | 40 ++++++++++++------- .../syntax/binded-reversed-application.yaml | 14 +++++++ 2 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java index b562dbfdc3..fe3f9c45b1 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PrintMojo.java @@ -28,10 +28,12 @@ import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Collection; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.cactoos.experimental.Threads; +import org.cactoos.iterable.Mapped; +import org.cactoos.number.SumOf; import org.cactoos.text.TextOf; import org.eolang.maven.util.HmBase; import org.eolang.maven.util.Home; @@ -72,23 +74,31 @@ public final class PrintMojo extends SafeMojo { @Override void exec() throws IOException { - final Collection sources = new Walk(this.printSourcesDir.toPath()); final Home home = new HmBase(this.printOutputDir); - for (final Path source : sources) { - final Path relative = Paths.get( - this.printSourcesDir.toPath().relativize(source).toString() - .replace(".xmir", ".eo") - ); - home.save(new XMIR(new TextOf(source)).toEO(), relative); - Logger.info( - this, - "Printed: %s => %s", source, this.printOutputDir.toPath().resolve(relative) - ); - } - if (sources.isEmpty()) { + final int total = new SumOf( + new Threads<>( + Runtime.getRuntime().availableProcessors(), + new Mapped<>( + source -> () -> { + final Path relative = Paths.get( + this.printSourcesDir.toPath().relativize(source).toString() + .replace(".xmir", ".eo") + ); + home.save(new XMIR(new TextOf(source)).toEO(), relative); + Logger.info( + this, + "Printed: %s => %s", source, this.printOutputDir.toPath().resolve(relative) + ); + return 1; + }, + new Walk(this.printSourcesDir.toPath()) + ) + ) + ).intValue(); + if (total == 0) { Logger.info(this, "No XMIR sources found"); } else { - Logger.info(this, "Printed %d XMIR sources into EO", sources.size()); + Logger.info(this, "Printed %d XMIR sources into EO", total); } } } diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml new file mode 100644 index 0000000000..f92c36da87 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml @@ -0,0 +1,14 @@ +# @todo #2729:60min Enable the test when it's possible. Current syntax is not supported now. In our +# EBNF such is understood as vertical application with 3 arguments. But all arguments in +# application must be either all bound or not. But it should not be like that with reversed +# application. Need to extend the grammar and make sure the test works. Don't forget to remove the +# puzzle. +skip: true +xsls: [] +tests: + - /program/errors[count(*)=0] +eo: | + if. > condition + TRUE + "TRUE":0 + "FALSE":1 \ No newline at end of file From 4e621edf8bc640f206a1a606cb2a06b2895e6daa Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Tue, 26 Dec 2023 21:26:23 +0300 Subject: [PATCH 09/19] fix(#2729): test --- .../java/org/eolang/maven/UnphiMojoTest.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/UnphiMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/UnphiMojoTest.java index 3316cb2f96..e667b05dba 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/UnphiMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/UnphiMojoTest.java @@ -23,19 +23,24 @@ */ package org.eolang.maven; +import com.jcabi.matchers.XhtmlMatchers; import com.jcabi.xml.XML; import com.jcabi.xml.XMLDocument; +import java.io.IOException; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Map; +import org.cactoos.io.InputOf; import org.cactoos.list.ListOf; import org.cactoos.text.TextOf; import org.eolang.jucs.ClasspathSource; import org.eolang.maven.util.HmBase; +import org.eolang.parser.EoSyntax; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; @@ -124,4 +129,37 @@ void convertsToXmirAndBack(final String pack, @TempDir final Path temp) throws E ) ); } + + @Disabled + @Test + void convertsValidXmirAndParsableEO(@TempDir final Path temp) throws IOException { + final Map map = new FakeMaven(temp) + .withProgram( + "[args] > app", + " QQ.io.stdout > @", + " \"Hello, world!\"" + ) + .with("printSourcesDir", temp.resolve("target/1-parse").toFile()) + .with("printOutputDir", temp.resolve("target/generated-sources").toFile()) + .execute(ParseMojo.class) + .execute(OptimizeMojo.class) + .execute(PhiMojo.class) + .execute(UnphiMojo.class) + .execute(PrintMojo.class) + .result(); + MatcherAssert.assertThat( + "Result EO code should be parsable", + new EoSyntax( + "test", + new InputOf( + new TextOf( + temp.resolve( + map.get("target/generated-sources/foo/x/main.eo") + ) + ) + ) + ).parsed(), + XhtmlMatchers.hasXPath("//errors[count(error)=0]") + ); + } } From 5e11a31e82cec719431e42708bf14597f6cff119 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 21:38:16 +0300 Subject: [PATCH 10/19] feat(#2422): another unstable test, typo --- .../src/main/java/org/eolang/maven/Place.java | 7 +++++-- .../eolang/maven/optimization/OptCachedTest.java | 13 +++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 9a8b5dc7c7..98e191770d 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -27,6 +27,7 @@ import java.nio.file.Path; import org.eolang.maven.name.DelimitedName; import org.eolang.maven.name.ObjectName; +import org.eolang.maven.util.JoinedUnderscore; /** * Make the place for the object. @@ -67,8 +68,10 @@ public Path make(final Path dir, final String ext) { out.append(this.name.title().replace(".", File.separator)); this.name.label().ifPresent( version -> { - out.append('_'); - out.append(version); + new JoinedUnderscore( + out.append('_').toString(), + out.append(version).toString() + ).asString(); }); if (!ext.isEmpty()) { out.append('.').append(ext); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java index 97d40790ca..146519d36f 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java @@ -35,6 +35,7 @@ import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.io.FileMatchers; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.io.TempDir; import org.xembly.Directives; @@ -44,7 +45,15 @@ * Test case for {@link org.eolang.maven.optimization.OptCached}. * @since 0.28.12 */ -class OptCachedTest { +final class OptCachedTest { + + /* + * @todo #2422:60min Test is unstable for now. + * We should resolve issues with unstable failures and only + * then enable the test. + * Also, see this issue. + */ + @Disabled @Test void returnsFromCacheIfXmlAlreadyInCache(@TempDir final Path tmp) throws IOException { final XML program = OptCachedTest.program(ZonedDateTime.now()); @@ -78,7 +87,7 @@ void optimizesIfXmlIsAbsentInCache(@TempDir final Path tmp) { } @Test - void optimizesBecauseChacheIsExpired(@TempDir final Path tmp) throws IOException { + void optimizesBecauseCacheIsExpired(@TempDir final Path tmp) throws IOException { final XML outdated = OptCachedTest.program(ZonedDateTime.now().minusMinutes(1)); final XML updated = OptCachedTest.program(ZonedDateTime.now()); OptCachedTest.save(tmp, outdated); From 314b6f7031d2ea4dcf9e3b4dce83d454cf2f6a4b Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Tue, 26 Dec 2023 21:52:33 +0300 Subject: [PATCH 11/19] added test pack for vertical method in scope --- .../eolang/parser/typos/vertical-method-in-scope.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 eo-parser/src/test/resources/org/eolang/parser/typos/vertical-method-in-scope.yaml diff --git a/eo-parser/src/test/resources/org/eolang/parser/typos/vertical-method-in-scope.yaml b/eo-parser/src/test/resources/org/eolang/parser/typos/vertical-method-in-scope.yaml new file mode 100644 index 0000000000..8cb62a51b8 --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/typos/vertical-method-in-scope.yaml @@ -0,0 +1,10 @@ +# @todo #2526:30min Enable the test when it's possible. Such syntax is invalid - scope braces should +# not be placed on different lines. It happens because of the next sequence of rules: +# scopeExtended -> happlicationExtended -> happlicationHeadExtended -> vmethod. The sequence +# allows using of vertical method in the head of scoped horizontal application. It should not be +# legal. Don't forget to remove the puzzle. +skip: true +line: 1 +eo: | + x (a + .b e).c > d \ No newline at end of file From c101f47b23cde1fd803678351e4c59857e5608e4 Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 21:54:18 +0300 Subject: [PATCH 12/19] feat(#2422): another unstable test, typo --- .../java/org/eolang/maven/optimization/OptCachedTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java index 146519d36f..17f684ad45 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/optimization/OptCachedTest.java @@ -47,8 +47,12 @@ */ final class OptCachedTest { - /* - * @todo #2422:60min Test is unstable for now. + /** + * Test case for XML program in cache. + * + * @param tmp Temp dir + * @throws IOException if I/O fails + * @todo #2422:60min returnsFromCacheIfXmlAlreadyInCache: this test is unstable. * We should resolve issues with unstable failures and only * then enable the test. * Also, see this issue. From 25c022263132d9917ed8ad5349ae82ba38c9f05d Mon Sep 17 00:00:00 2001 From: h1alexbel Date: Tue, 26 Dec 2023 22:03:19 +0300 Subject: [PATCH 13/19] feat(#2422): refined logic for Place --- eo-maven-plugin/src/main/java/org/eolang/maven/Place.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java index 98e191770d..bc418dc1bf 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/Place.java @@ -68,10 +68,7 @@ public Path make(final Path dir, final String ext) { out.append(this.name.title().replace(".", File.separator)); this.name.label().ifPresent( version -> { - new JoinedUnderscore( - out.append('_').toString(), - out.append(version).toString() - ).asString(); + out.append(new JoinedUnderscore("", version).asString()); }); if (!ext.isEmpty()) { out.append('.').append(ext); From 908a6ccc3a1fe8a2d4956e3fa08acb2d81a437f7 Mon Sep 17 00:00:00 2001 From: maxonfjvipon Date: Wed, 27 Dec 2023 00:53:42 +0300 Subject: [PATCH 14/19] fix(#2729): todo --- .../parser/packs/syntax/binded-reversed-application.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml index f92c36da87..03561b44bc 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/packs/syntax/binded-reversed-application.yaml @@ -1,8 +1,9 @@ # @todo #2729:60min Enable the test when it's possible. Current syntax is not supported now. In our # EBNF such is understood as vertical application with 3 arguments. But all arguments in # application must be either all bound or not. But it should not be like that with reversed -# application. Need to extend the grammar and make sure the test works. Don't forget to remove the -# puzzle. +# application. Need to extend the grammar and make sure the test works. +# Test UnphiMojoTest#convertsValidXmirAndParsableEO also does not work because of this. +# Don't forget to remove the puzzle. skip: true xsls: [] tests: From d807f70e07058b07fee7d8220a5900af88c2c529 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 27 Dec 2023 11:46:36 +0300 Subject: [PATCH 15/19] new location of codecov/codecov-action --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 611d409c82..deb76af9de 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -27,7 +27,7 @@ jobs: restore-keys: | maven- - run: mvn install -Pjacoco - - uses: codecov/codecov-action@v4.0.0-beta.3 + - uses: codecov/codecov-action@v4.0.0-beta.3.0.0-beta.3 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./eo-parser/target/site/jacoco/jacoco.xml,./eo-runtime/target/site/jacoco/jacoco.xml,./eo-maven-plugin/target/site/jacoco/jacoco.xml From b7318e37888eebbf18d463491386093928a83995 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 27 Dec 2023 13:04:08 +0300 Subject: [PATCH 16/19] revert --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index deb76af9de..611d409c82 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -27,7 +27,7 @@ jobs: restore-keys: | maven- - run: mvn install -Pjacoco - - uses: codecov/codecov-action@v4.0.0-beta.3.0.0-beta.3 + - uses: codecov/codecov-action@v4.0.0-beta.3 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./eo-parser/target/site/jacoco/jacoco.xml,./eo-runtime/target/site/jacoco/jacoco.xml,./eo-maven-plugin/target/site/jacoco/jacoco.xml From d71f05c9165a9be5bc46d3fc61c163de1c84724a Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 27 Dec 2023 14:03:29 +0300 Subject: [PATCH 17/19] #2719 -verbose --- .github/workflows/ebnf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ebnf.yml b/.github/workflows/ebnf.yml index 8ded61e44b..2d71b1484d 100644 --- a/.github/workflows/ebnf.yml +++ b/.github/workflows/ebnf.yml @@ -49,7 +49,7 @@ jobs: cp "eo-parser/target/ebnf/org/eolang/parser/${p}.pdf" . pdfcrop --margins '10 10 10 10' "${p}.pdf" "${p}-cropped.pdf" pdf2svg "${p}-cropped.pdf" "${p}.svg" - convert -density 300 -quality 100 -colorspace RGB "${p}.svg" "${p}.png" + convert -verbose -density 300 -quality 100 -colorspace RGB "${p}.svg" "${p}.png" mkdir -p gh-pages/ebnf cp "${p}.png" gh-pages/ebnf cp "${p}.svg" gh-pages/ebnf From 73732dc11f75f504f74449986a5bcb89e8e17299 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 27 Dec 2023 14:04:13 +0300 Subject: [PATCH 18/19] #2728 explained mutability --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 34aa190cfc..da880293f0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ All of them have something **we don't tolerate**: * static/class methods or attributes ([why?](http://www.yegor256.com/2014/05/05/oop-alternative-to-utility-classes.html)) * classes ([why?](http://www.yegor256.com/2016/09/20/oop-without-classes.html)) * implementation inheritance ([why?](http://www.yegor256.com/2016/09/13/inheritance-is-procedural.html)) - * mutability ([why?](http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html)) + * mutability ([why?](http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html) and [why not?](https://www.yegor256.com/2016/09/07/gradients-of-immutability.html)) * NULL ([why?](http://www.yegor256.com/2014/05/13/why-null-is-bad.html)) * global scope ([why?](https://www.yegor256.com/2018/07/03/global-variables.html)) * type casting ([why?](http://www.yegor256.com/2015/04/02/class-casting-is-anti-pattern.html)) From df058b855d2f12e824e107c0a001de24c68f05f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:42:05 +0000 Subject: [PATCH 19/19] chore(deps): update dependency com.yegor256:jping to v0.0.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index edbeb2b3e4..af98677dce 100644 --- a/pom.xml +++ b/pom.xml @@ -213,7 +213,7 @@ SOFTWARE. com.yegor256 jping - 0.0.2 + 0.0.3 test