From 52ff65a6ad72ae789cc989251b02c17db2fc7599 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Fri, 10 Jan 2025 11:44:18 +0300 Subject: [PATCH 01/23] #3797: better logging --- eo-maven-plugin/pom.xml | 2 +- .../main/java/org/eolang/maven/LintMojo.java | 131 ++++++++++-------- .../test/java/org/eolang/maven/FakeMaven.java | 4 +- .../java/org/eolang/maven/LintMojoTest.java | 2 +- .../src/test/resources/log4j.properties | 11 ++ eo-parser/src/test/resources/log4j.properties | 1 + 6 files changed, 88 insertions(+), 63 deletions(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index d345e3d31e..980eeddec7 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.26 + 0.0.31 org.glassfish diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 9f5127203c..ba2761e27a 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -28,6 +28,7 @@ import com.jcabi.xml.XMLDocument; import java.io.IOException; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -143,7 +144,7 @@ private int lintOne(final ForeignTojo tojo, final Path target = new Place(name).make(base, AssembleMojo.XMIR); tojo.withLinted( new FpDefault( - src -> this.counted(LintMojo.lint(xmir), counts).toString(), + src -> LintMojo.lint(xmir, counts).toString(), this.cache.toPath().resolve(LintMojo.CACHE), this.plugin.getVersion(), new TojoHash(tojo), @@ -175,103 +176,113 @@ private int lintAll(final ConcurrentHashMap counts) throws IO pkg.get(defect.program()), new ListOf<>(defect) ); + LintMojo.logOne(defect); } return pkg.size(); } /** - * Log errors of XMIR. - * @param xml XMIR. - * @param counts Counts of errors, warnings, and critical - * @return TRUE if it's good + * Log one defect. + * @param defect The defect to log */ - private XML counted(final XML xml, final ConcurrentHashMap counts) { - for (final XML error : xml.nodes("/program/errors/error")) { - final List line = error.xpath("@line"); - final StringBuilder message = new StringBuilder() - .append(Logger.format("%[file]s", xml.xpath("/program/@source").get(0))); - if (!line.isEmpty()) { - message.append(':').append(Integer.parseInt(line.get(0))); - } - message.append(' ') - .append(error.xpath("text()").get(0)) - .append(" (") - .append(error.xpath("@check").get(0)) - .append(' ') - .append(error.xpath("@severity").get(0)) - .append(')'); - final Severity severity = Severity.parsed(error.xpath("@severity").get(0)); - counts.compute(severity, (sev, before) -> before + 1); - switch (severity) { - case WARNING: - Logger.warn(this, message.toString()); - break; - case ERROR: - case CRITICAL: - Logger.error(this, message.toString()); - break; - default: - throw new IllegalArgumentException( - String.format("Not yet supported severity: %s", severity) - ); - } + private static void logOne(final Defect defect) { + final StringBuilder message = new StringBuilder() + .append(defect.program()) + .append(':').append(defect.line()) + .append(' ') + .append(defect.text()) + .append(" (") + .append(defect.rule()) + .append(' ') + .append(defect.severity()) + .append(')'); + switch (defect.severity()) { + case WARNING: + Logger.warn(LintMojo.class, message.toString()); + break; + case ERROR: + case CRITICAL: + Logger.error(LintMojo.class, message.toString()); + break; + default: + throw new IllegalArgumentException( + String.format( + "Not yet supported severity: %s", + defect.severity() + ) + ); } - return xml; } + /** + * Text in plural or singular form. + * @param count Counts of errors, warnings, and critical + * @param name Name of them + * @return Summary text + */ + private static String plural(final int count, final String name) { + final StringBuilder txt = new StringBuilder(); + txt.append(count).append(' ').append(name); + if (count > 1) { + txt.append('s'); + } + return txt.toString(); + } /** * Summarize the counts. * @param counts Counts of errors, warnings, and critical * @return Summary text */ private static String summary(final ConcurrentHashMap counts) { - final StringBuilder sum = new StringBuilder(100); + final List parts = new ArrayList<>(0); final int criticals = counts.get(Severity.CRITICAL); if (criticals > 0) { - sum.append(criticals).append(" critical error"); - if (criticals > 1) { - sum.append('s'); - } + parts.add(LintMojo.plural(criticals, "critical error")); } final int errors = counts.get(Severity.ERROR); if (errors > 0) { - if (sum.length() > 0) { - sum.append(", "); - } - sum.append(errors).append(" error"); - if (errors > 1) { - sum.append('s'); - } + parts.add(LintMojo.plural(errors, "error")); } final int warnings = counts.get(Severity.WARNING); if (warnings > 0) { - if (sum.length() > 0) { - sum.append(", "); - } - sum.append(warnings).append(" warning"); - if (warnings > 1) { - sum.append('s'); - } + parts.add(LintMojo.plural(warnings, "warning")); } - if (sum.length() == 0) { - sum.append("no complaints"); + if (parts.isEmpty()) { + parts.add("no complaints"); + } + final String sum; + if (parts.size() == 1) { + sum = parts.get(0); + } else if (parts.size() == 2) { + sum = String.join(" and ", parts); + } else { + sum = String.format( + "%s, and %s", + String.join(", ", parts.subList(0, parts.size() - 2)), + parts.get(parts.size() - 1) + ); } - return sum.toString(); + return sum; } /** * Find all possible linting defects and add them to the XMIR. * @param xmir The XML before linting + * @param counts Counts of errors, warnings, and critical * @return XML after linting - * @throws IOException If fails */ - private static XML lint(final XML xmir) throws IOException { + private static XML lint(final XML xmir, + final ConcurrentHashMap counts) { final Directives dirs = new Directives(); final Collection defects = new Program(xmir).defects(); if (!defects.isEmpty()) { dirs.xpath("/program").addIf("errors").strict(1); LintMojo.embed(xmir, defects); } + for (final Defect defect : defects) { + counts.compute(defect.severity(), (sev, before) -> before + 1); + LintMojo.logOne(defect); + } final Node node = xmir.inner(); new Xembler(dirs).applyQuietly(node); return new XMLDocument(node); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java index 7453c4ba45..970cca6a50 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java @@ -328,8 +328,10 @@ FakeMaven withPlacedBinary(final Path binary) { FakeMaven withHelloWorld() throws IOException { return this.withProgram( "+alias stdout org.eolang.io.stdout", + "+home https://www.eolang.org", + "+version 0.0.0", "+package f\n", - "# No comments.", + "# No comments here, since it's just an example.", "[x] > main", " (stdout \"Hello!\" x).print > @" ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java index 6ae37dca06..61670f7229 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java @@ -172,7 +172,7 @@ void detectsWarningWithCorrespondingFlag(@Mktmp final Path temp) throws IOExcept new XMLDocument( maven.result().get("target/6-lint/foo/x/main.xmir") ).nodes("//errors/error[@severity='warning']"), - Matchers.hasSize(Matchers.equalTo(6)) + Matchers.hasSize(Matchers.greaterThanOrEqualTo(6)) ); } diff --git a/eo-maven-plugin/src/test/resources/log4j.properties b/eo-maven-plugin/src/test/resources/log4j.properties index e965065312..190461ca3c 100644 --- a/eo-maven-plugin/src/test/resources/log4j.properties +++ b/eo-maven-plugin/src/test/resources/log4j.properties @@ -30,6 +30,17 @@ log4j.logger.org.eolang=INFO log4j.logger.com.yegor256.Jaxec=WARN log4j.logger.com.yegor256.farea=WARN log4j.logger.org.eolang.parser.Syntax=WARN +log4j.logger.org.eolang.maven.PlaceMojo=WARN +log4j.logger.org.eolang.maven.DiscoverMojo=WARN +log4j.logger.org.eolang.maven.RegisterMojo=WARN +log4j.logger.org.eolang.maven.CleanMojo=WARN +log4j.logger.org.eolang.maven.PhiMojo=WARN +log4j.logger.org.eolang.maven.ShakeMojo=WARN +log4j.logger.org.eolang.maven.UnphiMojo=WARN +log4j.logger.org.eolang.maven.LintMojo=INFO +log4j.logger.org.eolang.maven.ParseMojo=WARN +log4j.logger.org.eolang.maven.PrintMojo=WARN +log4j.logger.org.eolang.maven.OyIndexed=ERROR log4j.logger.com.jcabi.log.VerboseProcess=WARN log4j.logger.org.eolang.parser.EoSyntax=WARN log4j.logger.org.eolang.parser.Program=WARN diff --git a/eo-parser/src/test/resources/log4j.properties b/eo-parser/src/test/resources/log4j.properties index 93ee7ca82c..aa662f6aa2 100644 --- a/eo-parser/src/test/resources/log4j.properties +++ b/eo-parser/src/test/resources/log4j.properties @@ -26,6 +26,7 @@ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=com.jcabi.log.MulticolorLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss} [%color{%p}] %c: %m%n +log4j.logger.org.eolang.parser.StrictXmir=ERROR log4j.logger.com.jcabi.log=WARN log4j.logger.com.yegor256.xsline=WARN log4j.logger.com.yegor256.xsline.StSchema=DEBUG From 58fe286ce68caeb8306dc6f0a56b940ec6ce23fa Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Fri, 10 Jan 2025 12:30:16 +0300 Subject: [PATCH 02/23] #3797: shorter --- eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java | 2 -- eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index ba2761e27a..8e096c5970 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -193,8 +193,6 @@ private static void logOne(final Defect defect) { .append(defect.text()) .append(" (") .append(defect.rule()) - .append(' ') - .append(defect.severity()) .append(')'); switch (defect.severity()) { case WARNING: diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java index 970cca6a50..b04078bf79 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java @@ -329,8 +329,9 @@ FakeMaven withHelloWorld() throws IOException { return this.withProgram( "+alias stdout org.eolang.io.stdout", "+home https://www.eolang.org", + "+package foo.x", "+version 0.0.0", - "+package f\n", + "", "# No comments here, since it's just an example.", "[x] > main", " (stdout \"Hello!\" x).print > @" From 02dd8f49d6b84ec1012c1237fdf4febd7a66a716 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Fri, 10 Jan 2025 12:32:46 +0300 Subject: [PATCH 03/23] #3797: typo --- eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java | 1 + 1 file changed, 1 insertion(+) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 8e096c5970..61f5e8b5fc 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -226,6 +226,7 @@ private static String plural(final int count, final String name) { } return txt.toString(); } + /** * Summarize the counts. * @param counts Counts of errors, warnings, and critical From dc416a7cb33fe1529c99126ea2d720b5c21b0b59 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Fri, 10 Jan 2025 12:33:49 +0300 Subject: [PATCH 04/23] #3797: compact --- eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 61f5e8b5fc..bda6a1132c 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -250,9 +250,7 @@ private static String summary(final ConcurrentHashMap counts) parts.add("no complaints"); } final String sum; - if (parts.size() == 1) { - sum = parts.get(0); - } else if (parts.size() == 2) { + if (parts.size() < 3) { sum = String.join(" and ", parts); } else { sum = String.format( From 6b4ea54507398b4d5a9b3519d037fe2fa366d62f Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 14 Jan 2025 17:13:29 +0300 Subject: [PATCH 05/23] #3797: up to 32 --- eo-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 980eeddec7..6d3f65a46c 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.31 + 0.0.32 org.glassfish From 12d5d25c03f37f57813f7884b5508dd56beb80c0 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 14 Jan 2025 18:29:52 +0300 Subject: [PATCH 06/23] #3797: eo skip on qulice --- .github/workflows/qulice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qulice.yml b/.github/workflows/qulice.yml index 41eaa9bf7a..f6e7b6f72d 100644 --- a/.github/workflows/qulice.yml +++ b/.github/workflows/qulice.yml @@ -43,4 +43,4 @@ jobs: path: ~/.m2/repository key: ubuntu-qulice-jdk-21-maven-${{ hashFiles('**/pom.xml') }} restore-keys: ubuntu-qulice-jdk-21-maven- - - run: mvn clean verify -PskipTests -Pqulice --errors --batch-mode + - run: mvn clean verify -PskipTests -Deo.skip -Pqulice --errors --batch-mode From a229d2637b5fa998cebc2b6d73dba7baee151879 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 07:47:01 +0300 Subject: [PATCH 07/23] #3797: version up --- .github/.typos.toml | 27 -- _typos.toml => .github/typos.toml | 27 ++ .../workflows/ort.yml | 34 +- .../workflows/phi-sample.yml | 28 +- .github/workflows/typos.yml | 2 +- .gitignore | 2 +- .mvn/jvm.config | 2 +- .../eo-packs/shake/add-refs.yml => .ort.yml | 33 +- .xcop | 2 +- README.md | 2 +- eo-maven-plugin/README.md | 70 +++- eo-maven-plugin/pom.xml | 10 +- .../src/main/eo/org/eolang/examples/app.eo | 1 - .../java/org/eolang/maven/DiscoverMojo.java | 1 - .../main/java/org/eolang/maven/PhiMojo.java | 5 + .../main/java/org/eolang/maven/TrShaking.java | 12 +- .../java/org/eolang/maven/TranspileMojo.java | 6 +- .../main/java/org/eolang/maven/UnphiMojo.java | 1 + .../org/eolang/maven/latex/latex-template.txt | 2 +- .../org/eolang/maven/sodg/_macros.xsl | 3 - .../maven/transpile/align-test-classes.xsl | 47 --- .../maven/transpile/anonymous-to-nested.xsl | 19 +- .../org/eolang/maven/transpile/attrs.xsl | 42 ++- .../org/eolang/maven/transpile/classes.xsl | 2 +- .../remove-high-level-inner-classes.xsl | 42 --- .../maven/transpile/rename-tests-inners.xsl | 92 ----- .../org/eolang/maven/transpile/tests.xsl | 72 +--- .../org/eolang/maven/transpile/to-java.xsl | 308 ++++++++++++----- .../org/eolang/maven/ArchitectureTest.java | 70 ++++ .../test/java/org/eolang/maven/FakeMaven.java | 1 + .../java/org/eolang/maven/LintMojoTest.java | 4 +- .../java/org/eolang/maven/ParseMojoTest.java | 4 +- .../java/org/eolang/maven/PhiMojoTest.java | 74 ++++ .../org/eolang/maven/TranspileMojoTest.java | 3 +- .../java/org/eolang/maven/UnphiMojoTest.java | 75 +++++ .../org/eolang/maven/UnplaceMojoTest.java | 1 - .../src/test/resources/log4j.properties | 1 + .../org/eolang/maven/binarize/wrong-rust.eo | 1 - .../org/eolang/maven/commits/tags.txt | 2 +- ...ath-dependencies-transient-dependency.json | 76 +++-- .../eo-math-dependencies-without-foreign.json | 249 ++++++++------ .../test/resources/org/eolang/maven/mess.eo | 1 + .../org/eolang/maven/sodgs/abstracts.yaml | 1 + .../org/eolang/maven/sodgs/arrays.yaml | 1 + .../org/eolang/maven/sodgs/atoms.yaml | 1 + .../org/eolang/maven/sodgs/dots.yaml | 1 + .../org/eolang/maven/sodgs/refs.yaml | 1 + .../transpile-packs/bindings-to-java.yaml | 5 +- .../bound-globals-to-java.yaml | 23 +- ...nverts-to-java-with-arrays-and-scopes.yaml | 21 -- .../maven/transpile-packs/data-as-bytes.yaml | 11 +- .../maven/transpile-packs/embedded-class.yaml | 15 +- .../transpile-packs/locators-to-java.yaml | 20 +- .../transpile-packs/long-class-name.yaml | 8 +- .../maven/transpile-packs/set-package.yaml | 1 - .../synthetic-attributes-with-to-java.yaml | 68 ---- .../transpile-packs/test-object-to-java.yaml | 2 - .../maven/transpile-packs/tests-test.yaml | 10 +- ...-inside.yaml => tests-with-abstracts.yaml} | 33 +- .../transpile-packs/to-java-without-refs.yaml | 32 +- .../maven/transpile-packs/tuple-to-java.yaml | 18 +- .../transpile-packs/underscore-to-java.yaml | 2 - eo-parser/.gitignore | 2 +- eo-parser/README.md | 2 - .../src/main/antlr4/org/eolang/parser/Eo.g4 | 2 +- .../org/eolang/parser/EoParserErrors.java | 39 ++- .../main/java/org/eolang/parser/Lines.java | 2 +- .../main/java/org/eolang/parser/StUnhex.java | 1 - .../main/java/org/eolang/parser/StXPath.java | 1 - .../java/org/eolang/parser/TrCanonical.java | 30 +- .../java/org/eolang/parser/XeEoListener.java | 15 +- .../src/main/java/org/eolang/parser/Xmir.java | 4 +- .../eolang/parser/parse/stars-to-tuples.xsl | 83 ++--- .../org/eolang/parser/phi/to-phi.xsl | 13 +- .../org/eolang/parser/phi/to-salty-phi.xsl | 7 - .../eolang/parser/print/dataized-to-const.xsl | 6 +- .../eolang/parser/print/tuples-to-stars.xsl | 24 +- .../parser/shake/abstracts-float-up.xsl | 192 ----------- .../parser/shake/add-default-package.xsl | 13 +- .../org/eolang/parser/shake/add-refs.xsl | 119 ------- .../org/eolang/parser/shake/build-fqns.xsl | 245 ++++++++++++++ .../org/eolang/parser/shake/explicit-data.xsl | 3 - .../eolang/parser/shake/fix-missed-names.xsl | 55 --- .../org/eolang/parser/shake/remove-refs.xsl | 35 -- .../eolang/parser/shake/resolve-aliases.xsl | 14 +- .../org/eolang/parser/shake/vars-float-up.xsl | 6 - .../java/org/eolang/parser/EoSyntaxTest.java | 30 +- .../org/eolang/parser/XslBenchmarkIT.java | 6 +- .../parser/eo-packs/parse/before-star.yaml | 8 +- .../eolang/parser/eo-packs/parse/tuples.yaml | 25 +- .../eo-packs/print/dataized-to-const.yaml | 6 +- .../eo-packs/print/tuples-to-stars.yaml | 6 +- .../parser/eo-packs/shake/add-locators.yaml | 14 +- .../eo-packs/shake/add-probes-to-empty.yaml | 6 +- .../parser/eo-packs/shake/add-probes.yaml | 6 +- .../eo-packs/shake/adds-default-package.yaml | 6 +- .../parser/eo-packs/shake/adds-no-probes.yaml | 6 +- .../parser/eo-packs/shake/adds-refs.yaml | 61 ---- .../eo-packs/shake/as-type-optimization.yaml | 39 --- .../parser/eo-packs/shake/build-fqn.yaml | 64 ++++ .../parser/eo-packs/shake/explicit-data.yaml | 4 +- .../shake/fix-names-with-duplicates.yaml | 58 ---- .../eo-packs/shake/float-abstracts.yaml | 70 ---- .../eo-packs/shake/float-and-keep-names.yaml | 38 --- .../eo-packs/shake/float-atom-vars.yaml | 2 +- .../parser/eo-packs/shake/float-atom.yaml | 37 -- .../eo-packs/shake/float-up-same-attrs.yaml | 56 ---- .../parser/eo-packs/shake/float-vars.yaml | 9 +- .../eo-packs/shake/not-redundant-levels.yaml | 52 --- .../parser/eo-packs/shake/recursion.yaml | 6 +- ...s-with-arguments-and-abstract-parents.yaml | 80 ----- ...nt-levels-with-arguments-and-siblings.yaml | 69 ---- .../shake/redundant-levels-with-arrays.yaml | 65 ---- .../shake/redundant-levels-with-siblings.yaml | 65 ---- .../eo-packs/shake/redundant-levels.yaml | 63 ---- .../eo-packs/shake/resolves-aliases.yaml | 5 +- ...mes.yaml => skips-fqns-in-primitives.yaml} | 30 +- .../parser/eo-typos/binding-with-rho.yaml | 8 +- .../eolang/parser/eo-typos/broken-head.yaml | 5 +- .../parser/eo-typos/comment-in-method.yaml | 13 +- .../parser/eo-typos/double-empty-lines.yaml | 4 +- .../eo-typos/empty-line-between-metas.yaml | 2 +- .../parser/eo-typos/not-empty-atoms.yaml | 2 +- .../simple-application-named.yaml | 7 +- .../simple-application.yaml | 7 +- .../eo-typos/trailing-space-in-comment.yaml | 30 -- .../eolang/parser/eo-typos/two-spaces.yaml | 12 + .../eo-typos/vmethod-after-happlication.yaml | 2 +- .../eo-typos/vmethod-after-hmethod.yaml | 2 +- .../org/eolang/parser/phi-packs/fibonaci.yaml | 9 +- .../org/eolang/parser/phi-packs/jeo-part.yaml | 7 +- .../parser/phi-packs/nested-bindings.yaml | 83 +++++ .../org/eolang/parser/phi-packs/nested.yaml | 4 +- .../eolang/parser/phi-packs/string-part.yaml | 19 +- eo-runtime/README.md | 4 +- eo-runtime/pom.xml | 2 +- eo-runtime/src/main/eo/org/eolang/bytes.eo | 32 +- eo-runtime/src/main/eo/org/eolang/dataized.eo | 2 +- eo-runtime/src/main/eo/org/eolang/false.eo | 2 + eo-runtime/src/main/eo/org/eolang/fs/dir.eo | 54 +-- eo-runtime/src/main/eo/org/eolang/fs/file.eo | 122 +++---- eo-runtime/src/main/eo/org/eolang/fs/path.eo | 124 +++---- .../src/main/eo/org/eolang/fs/tmpdir.eo | 61 ++-- eo-runtime/src/main/eo/org/eolang/go.eo | 11 +- eo-runtime/src/main/eo/org/eolang/i16.eo | 6 +- eo-runtime/src/main/eo/org/eolang/i32.eo | 28 +- eo-runtime/src/main/eo/org/eolang/i64.eo | 19 +- .../main/eo/org/eolang/io/bytes-as-input.eo | 12 +- .../src/main/eo/org/eolang/io/console.eo | 8 +- .../src/main/eo/org/eolang/io/dead-input.eo | 2 +- .../src/main/eo/org/eolang/io/dead-output.eo | 2 +- .../src/main/eo/org/eolang/io/input-length.eo | 4 +- .../main/eo/org/eolang/io/malloc-as-output.eo | 4 +- eo-runtime/src/main/eo/org/eolang/io/stdin.eo | 10 +- .../src/main/eo/org/eolang/io/tee-input.eo | 8 +- eo-runtime/src/main/eo/org/eolang/malloc.eo | 13 +- .../src/main/eo/org/eolang/math/angle.eo | 13 +- eo-runtime/src/main/eo/org/eolang/math/e.eo | 2 + .../src/main/eo/org/eolang/math/integral.eo | 29 +- .../src/main/eo/org/eolang/math/numbers.eo | 4 +- .../src/main/eo/org/eolang/math/random.eo | 10 +- .../src/main/eo/org/eolang/math/real.eo | 11 +- .../main/eo/org/eolang/negative-infinity.eo | 22 +- .../src/main/eo/org/eolang/net/socket.eo | 67 ++-- eo-runtime/src/main/eo/org/eolang/number.eo | 33 +- .../main/eo/org/eolang/positive-infinity.eo | 22 +- eo-runtime/src/main/eo/org/eolang/seq.eo | 23 +- eo-runtime/src/main/eo/org/eolang/string.eo | 42 +-- .../eo/org/eolang/structs/bytes-as-array.eo | 15 +- .../eo/org/eolang/structs/hash-code-of.eo | 10 +- .../src/main/eo/org/eolang/structs/list.eo | 205 ++++++------ .../src/main/eo/org/eolang/structs/map.eo | 138 ++++---- .../eo/org/eolang/structs/range-of-ints.eo | 1 + .../src/main/eo/org/eolang/structs/set.eo | 23 +- eo-runtime/src/main/eo/org/eolang/switch.eo | 6 +- eo-runtime/src/main/eo/org/eolang/sys/os.eo | 2 +- .../src/main/eo/org/eolang/sys/posix.eo | 1 - .../src/main/eo/org/eolang/sys/win32.eo | 1 - eo-runtime/src/main/eo/org/eolang/true.eo | 2 + eo-runtime/src/main/eo/org/eolang/tuple.eo | 46 ++- .../src/main/eo/org/eolang/txt/regex.eo | 8 +- eo-runtime/src/main/eo/org/eolang/txt/text.eo | 316 ++++++++++-------- eo-runtime/src/main/eo/org/eolang/while.eo | 2 +- .../java/EOorg/EOeolang/EObytes$EOor.java | 1 - .../java/EOorg/EOeolang/EOnumber$EOtimes.java | 6 +- .../EOsys/Posix/GettimeofdaySyscall.java | 2 +- .../EOsys/Win32/GetSystemTimeFuncCall.java | 2 +- .../src/main/java/org/eolang/Action.java | 39 --- .../src/main/java/org/eolang/AtComposite.java | 2 +- .../src/main/java/org/eolang/AtLogged.java | 5 +- .../src/main/java/org/eolang/AtOnce.java | 3 +- .../src/main/java/org/eolang/AtRho.java | 7 +- .../src/main/java/org/eolang/AtSetRho.java | 57 ---- .../src/main/java/org/eolang/AtVoid.java | 4 +- .../eolang/{AtGetOnly.java => AtWithRho.java} | 41 ++- .../src/main/java/org/eolang/AtomSafe.java | 6 +- eo-runtime/src/main/java/org/eolang/Attr.java | 5 +- eo-runtime/src/main/java/org/eolang/Data.java | 25 +- .../src/main/java/org/eolang/ExFailure.java | 1 - .../src/main/java/org/eolang/ExUnset.java | 1 - .../src/main/java/org/eolang/Expect.java | 195 ++++++++++- eo-runtime/src/main/java/org/eolang/Main.java | 9 +- .../src/main/java/org/eolang/PhDefault.java | 75 +++-- .../src/main/java/org/eolang/PhFake.java | 54 --- .../src/main/java/org/eolang/PhLambda.java | 40 --- .../src/main/java/org/eolang/PhLogged.java | 18 +- .../src/main/java/org/eolang/PhOnce.java | 13 +- .../src/main/java/org/eolang/PhPackage.java | 9 +- .../src/main/java/org/eolang/PhSafe.java | 36 +- eo-runtime/src/main/java/org/eolang/Phi.java | 21 +- .../src/main/java/org/eolang/XmirPackage.java | 48 --- .../src/test/eo/org/eolang/fs/dir-tests.eo | 4 +- .../src/test/eo/org/eolang/fs/file-tests.eo | 1 + eo-runtime/src/test/eo/org/eolang/go-tests.eo | 1 + .../test/eo/org/eolang/io/tee-input-tests.eo | 2 +- .../src/test/eo/org/eolang/malloc-tests.eo | 1 + .../eo/org/eolang/negative-infinity-tests.eo | 1 - .../src/test/eo/org/eolang/runtime-tests.eo | 1 + .../src/test/eo/org/eolang/seq-tests.eo | 1 + .../test/eo/org/eolang/structs/list-tests.eo | 1 + .../src/test/eo/org/eolang/switch-tests.eo | 1 + .../src/test/eo/org/eolang/tuple-tests.eo | 4 +- .../test/eo/org/eolang/txt/sscanf-tests.eo | 14 +- .../src/test/eo/org/eolang/while-tests.eo | 1 + eo-runtime/src/test/groovy/verify.groovy | 1 - .../EOorg/EOeolang/EOio/InputOutputTest.java | 10 +- .../EOorg/EOeolang/EOnumber$EOtimesTest.java | 27 +- .../EOorg/EOeolang/EOsys/EOposixTest.java | 3 +- .../EOorg/EOeolang/EOsys/EOwin32Test.java | 3 +- .../test/java/EOorg/EOeolang/HeapsTest.java | 68 ++-- .../src/test/java/integration/SnippetIT.java | 0 .../java/org/eolang/AtEnvelope.java | 9 +- .../java/org/eolang/AtSimple.java | 11 +- .../src/test/java/org/eolang/ExpectTest.java | 242 +++++++++++++- .../test/java/org/eolang/PhDefaultTest.java | 2 +- .../test/java/org/eolang/PhPackageTest.java | 2 - .../test/java/org/eolang/XmirObjectTest.java | 6 + eo-runtime/src/test/resources/jul.properties | 2 +- pom.xml | 2 +- renovate.json | 12 +- 240 files changed, 3163 insertions(+), 3430 deletions(-) delete mode 100644 .github/.typos.toml rename _typos.toml => .github/typos.toml (54%) rename eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/no-ref-to-primitives.yaml => .github/workflows/ort.yml (77%) rename eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-nested-anonymous.yaml => .github/workflows/phi-sample.yml (71%) rename eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-refs.yml => .ort.yml (63%) delete mode 100644 eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/align-test-classes.xsl rename eo-parser/src/main/resources/org/eolang/parser/shake/remove-levels.xsl => eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/anonymous-to-nested.xsl (75%) delete mode 100644 eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/remove-high-level-inner-classes.xsl delete mode 100644 eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/rename-tests-inners.xsl create mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/ArchitectureTest.java mode change 100755 => 100644 eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java delete mode 100644 eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/synthetic-attributes-with-to-java.yaml rename eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/{tests-moving-inside.yaml => tests-with-abstracts.yaml} (52%) rename eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-noname-abstracts.yaml => eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/to-java-without-refs.yaml (65%) delete mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/abstracts-float-up.xsl delete mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl create mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl delete mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/fix-missed-names.xsl delete mode 100644 eo-parser/src/main/resources/org/eolang/parser/shake/remove-refs.xsl delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-refs.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/as-type-optimization.yaml create mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/fix-names-with-duplicates.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-abstracts.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-and-keep-names.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-up-same-attrs.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/not-redundant-levels.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-abstract-parents.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-siblings.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arrays.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-siblings.yaml delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels.yaml rename eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/{floating-sets-parent-names.yaml => skips-fqns-in-primitives.yaml} (70%) delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml create mode 100644 eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml delete mode 100644 eo-runtime/src/main/java/org/eolang/Action.java delete mode 100644 eo-runtime/src/main/java/org/eolang/AtSetRho.java rename eo-runtime/src/main/java/org/eolang/{AtGetOnly.java => AtWithRho.java} (66%) delete mode 100644 eo-runtime/src/main/java/org/eolang/PhFake.java delete mode 100644 eo-runtime/src/main/java/org/eolang/PhLambda.java delete mode 100644 eo-runtime/src/main/java/org/eolang/XmirPackage.java mode change 100755 => 100644 eo-runtime/src/test/java/integration/SnippetIT.java rename eo-runtime/src/{main => test}/java/org/eolang/AtEnvelope.java (87%) rename eo-runtime/src/{main => test}/java/org/eolang/AtSimple.java (86%) diff --git a/.github/.typos.toml b/.github/.typos.toml deleted file mode 100644 index f282f8c719..0000000000 --- a/.github/.typos.toml +++ /dev/null @@ -1,27 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. - -[files] -extend-exclude = [ - "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOis_directory.java", - "eo-parser/src/test/resources/org/eolang/parser/benchmark/native.xmir" -] diff --git a/_typos.toml b/.github/typos.toml similarity index 54% rename from _typos.toml rename to .github/typos.toml index d0573dbcbe..626c8d9601 100644 --- a/_typos.toml +++ b/.github/typos.toml @@ -20,6 +20,33 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +[files] +extend-exclude = [ + "eo-runtime/src/main/java/EOorg/EOeolang/EOfs/EOfile$EOis_directory.java", + "eo-parser/src/test/resources/org/eolang/parser/benchmark/native.xmir" +] +# The MIT License (MIT) +# +# Copyright (c) 2016-2025 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. + [default] extend-ignore-identifiers-re = [ "Olt*", # false positive diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/no-ref-to-primitives.yaml b/.github/workflows/ort.yml similarity index 77% rename from eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/no-ref-to-primitives.yaml rename to .github/workflows/ort.yml index c946aff628..746bee42e8 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/no-ref-to-primitives.yaml +++ b/.github/workflows/ort.yml @@ -20,22 +20,18 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- -sheets: - - /org/eolang/parser/shake/add-refs.xsl -asserts: - - /program[not(errors)] - - /program/objects[count(.//o[@ref])=0] -input: | - +package org.eolang - - # Bytes. - [] > bytes - $.eq 01- > yes - - # String. - [] > string - string > x - - # Number. - [] > number - number > x +name: ort +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + ort: + runs-on: ubuntu-24.04 + steps: + - run: git config --global url.https://github.com/.insteadOf ssh://git@github.com/ + - uses: actions/checkout@v4 + - uses: oss-review-toolkit/ort-ci-github-action@v1 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-nested-anonymous.yaml b/.github/workflows/phi-sample.yml similarity index 71% rename from eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-nested-anonymous.yaml rename to .github/workflows/phi-sample.yml index 2ca1901c60..a434ead5fe 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-nested-anonymous.yaml +++ b/.github/workflows/phi-sample.yml @@ -20,13 +20,21 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- -sheets: - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl -asserts: - - //o[@base='foo']/o[@base='t0$a0'] - - //o[@name='t0$a0']/o[@base='x' and @name='@'] -input: | - foo > a - [x] - x > @ +name: phi-sample +on: + push: + branches: + - master +jobs: + phi-sample: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + - run: | + mkdir -p gh-pages + cp eo-parser/src/test/resources/org/eolang/parser/phi-syntax/all-the-basics.phi gh-pages/sample.phi + - uses: JamesIves/github-pages-deploy-action@v4.7.2 + with: + branch: gh-pages + folder: gh-pages + clean: false diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml index 93f0c57d3e..aaf7d72039 100644 --- a/.github/workflows/typos.yml +++ b/.github/workflows/typos.yml @@ -36,4 +36,4 @@ jobs: - uses: actions/checkout@v4 - uses: crate-ci/typos@master with: - config: ./.github/.typos.toml + config: ./.github/typos.toml diff --git a/.gitignore b/.gitignore index 3f2da2c851..cfe92b3d35 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,4 @@ target/ eo-maven-plugin/lib eo-runtime/lib eo-runtime/measures.csv -xs3p.xsl_* \ No newline at end of file +xs3p.xsl_* diff --git a/.mvn/jvm.config b/.mvn/jvm.config index c25ad6d1f1..b094891ac3 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -1 +1 @@ --Xmx4096m -Xms1024m -XX:+HeapDumpOnOutOfMemoryError \ No newline at end of file +-Xmx4096m -Xms1024m -XX:+HeapDumpOnOutOfMemoryError diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-refs.yml b/.ort.yml similarity index 63% rename from eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-refs.yml rename to .ort.yml index 3d494ab363..a59d2aa79e 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-refs.yml +++ b/.ort.yml @@ -19,17 +19,24 @@ # 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. + +# See https://oss-review-toolkit.org/ort/docs/configuration/ort-yml for file specification --- -sheets: - - /org/eolang/parser/shake/add-refs.xsl -document: - - - - - - - - -asserts: - - /program/objects/o[@name='a']/o[@base='a'] +license_choices: + package_license_choices: + - package_id: "Maven:org.glassfish:javax.json:1.1.4" + license_choices: + - given: CDDL-1.1 OR GPL-2.0-only + choice: CDDL-1.1 + - package_id: "Maven:javax.json:javax.json-api:1.1.4" + license_choices: + - given: CDDL-1.1 OR GPL-2.0-only + choice: CDDL-1.1 +excludes: + scopes: + - pattern: "provided.*" + reason: "TEST_DEPENDENCY_OF" + comment: "Packages provided" + - pattern: "test.*" + reason: "TEST_DEPENDENCY_OF" + comment: "Packages for testing only" diff --git a/.xcop b/.xcop index 3a6be92ffe..dda89c8b7e 100644 --- a/.xcop +++ b/.xcop @@ -1 +1 @@ ---exclude=paper/**.xml \ No newline at end of file +--exclude=paper/**.xml diff --git a/README.md b/README.md index a2bbda5f9d..6488020b08 100644 --- a/README.md +++ b/README.md @@ -181,7 +181,7 @@ This is how you iterate: * x.put 2 while - x.as-number.lt 6 > [i] + x.as-number.lt 6 > [i] >> [i] >> seq > @ * diff --git a/eo-maven-plugin/README.md b/eo-maven-plugin/README.md index 659bc3da0e..a0696e4f09 100644 --- a/eo-maven-plugin/README.md +++ b/eo-maven-plugin/README.md @@ -3,9 +3,9 @@ [![Maven Central](https://img.shields.io/maven-central/v/org.eolang/eo-maven-plugin.svg)](https://maven-badges.herokuapp.com/maven-central/org.eolang/eo-maven-plugin) [![Javadoc](http://www.javadoc.io/badge/org.eolang/eo-maven-plugin.svg)](http://www.javadoc.io/doc/org.eolang/eo-maven-plugin) -This is Maven plugin for EO. +This is a Maven plugin for EO. -Here is a simple program that gets a year from command line and tells you +Here is a simple program that gets a year from a command line and tells you whether it's leap or not: ```eo @@ -24,7 +24,7 @@ whether it's leap or not: ``` -In order to compile this program, put it into `src/main/eo/main.eo` and then +To compile this program, put it into `src/main/eo/main.eo` and then create a file `pom.xml` with this content (it's just a sample): ```xml @@ -35,7 +35,7 @@ create a file `pom.xml` with this content (it's just a sample): org.eolang eo-maven-plugin - 0.50.0 + 0.50.1 @@ -111,7 +111,7 @@ for most popular and important objects that any of you will need in order to write even a simple EO program. There are objects like `string`, `int`, `sprintf`, `stdout`, and so on. By the way, you may want to contribute there by creating new objects. -## Objectionary objects cache +### Objectionary objects cache If any external object is used in EO program it will be pulled from [Objectionary home](https://github.com/objectionary/home). By default, during compilation the plugin will check local cache (`~/.eo`) for required objects @@ -124,7 +124,7 @@ Maven option `-U` (see [Maven CLI docs](https://maven.apache.org/ref/3.1.0/maven mvn -U clean install ``` -If you want to build your project or run your tests which use eo-maven-plugin, you can change stack +If you want to build your project or run your tests, which use eo-maven-plugin, you can change stack size for your purposes by stack-size option: ```shell @@ -133,10 +133,62 @@ mvn clean install -Pqulice -Dstack-size=1M where 1M is size of stack. By default stack-size = 256M in eo-maven-plugin, maximum size is 1G. -## How to run Integration Tests only +## PHI and UNPHI Transformations + +`eo-maven-plugin` supports PHI/UNPHI transformations. +To transform your XMIR files, you need to add the following plugin configuration to your `pom.xml`: + +```xml + + org.eolang + eo-maven-plugin + 0.50.1 + + + xmir-to-phi + process-classes + + xmir-to-phi + + + ${eo.xmir.files} + ${eo.phi.files} + + + + phi-to-xmir + process-classes + + phi-to-xmir + + + ${eo.phi.files} + ${eo.xmir.files} + + + + +``` + +Pay attention, that `PHI/UNPHI` transformations don't support `metas` objects +in the current version of the plugin. +This might lead to possible loss of information about an object's metadata. +You can read more about it [here](https://github.com/objectionary/eo/issues/3812#issuecomment-2589728681). + +## How To Build Plugin + +To build the plugin and install it locally, run the following command under the `eo-maven-plugin` directory: + +```shell +mvn clean install -Pqulice +``` + +It will build the plugin and install it in your local Maven repository. + +### How to run Integration Tests only If you want to run a specific integration test without waiting until other unit or integration tests -are executed you need to go to `eo-maven-plugin` directory and execute the next command: +are executed, you might execute the following command under the `eo-maven-plugin` directory: ```shell mvn clean integration-test invoker:run -Dinvoker.test=fibonacci -DskipTests @@ -145,7 +197,7 @@ mvn clean integration-test invoker:run -Dinvoker.test=fibonacci -DskipTests Here `fibonacci` is the name of the desired integration test, `-DskipTests` is used in order to skip `eo-maven-plugin` unit tests. -## How to disable Integration Tests +### How to disable Integration Tests It is sometime necessary to temporarily disable the integration tests (for example for introducing braking changes into plugin or EO runtime). This can be achieved by disabling `maven-invoker-plugin` diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 6d3f65a46c..216a4b0955 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.32 + 1.0-SNAPSHOT org.glassfish @@ -216,7 +216,7 @@ SOFTWARE. com.opencsv opencsv - 5.9 + 5.10 runtime @@ -281,6 +281,12 @@ SOFTWARE. jping + + com.tngtech.archunit + archunit + 1.3.0 + test + diff --git a/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/app.eo b/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/app.eo index 62199ac517..7e59b5187e 100644 --- a/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/app.eo +++ b/eo-maven-plugin/src/it/fibonacci/src/main/eo/org/eolang/examples/app.eo @@ -47,4 +47,3 @@ "%dth Fibonacci number is %d\n" * n f e.eq f - diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/DiscoverMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/DiscoverMojo.java index 7c36c5e3cd..62b436d44b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/DiscoverMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/DiscoverMojo.java @@ -58,7 +58,6 @@ public final class DiscoverMojo extends SafeMojo { " and @base != '^'", " and @base != '$'", " and @base != '∅'", - " and not(@ref)", "]/@base" ); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java index ae172ed12d..bd53198620 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PhiMojo.java @@ -54,6 +54,11 @@ public final class PhiMojo extends SafeMojo { */ public static final String EXT = "phi"; + /** + * Subdirectory for parsed cache. + */ + static final String CACHE = "phied"; + /** * The directory where to take xmir files for translation from. * @checkstyle MemberNameCheck (10 lines) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/TrShaking.java b/eo-maven-plugin/src/main/java/org/eolang/maven/TrShaking.java index 34831bb79e..7335b02473 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/TrShaking.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/TrShaking.java @@ -41,23 +41,15 @@ final class TrShaking extends TrEnvelope { new TrFull( new TrClasspath<>( "/org/eolang/parser/shake/cti-adds-errors.xsl", - "/org/eolang/parser/shake/add-refs.xsl", + "/org/eolang/parser/shake/vars-float-up.xsl", + "/org/eolang/parser/shake/build-fqns.xsl", "/org/eolang/parser/shake/expand-qqs.xsl", "/org/eolang/parser/shake/add-probes.xsl", - "/org/eolang/parser/shake/vars-float-up.xsl", "/org/eolang/parser/shake/expand-aliases.xsl", "/org/eolang/parser/shake/resolve-aliases.xsl", "/org/eolang/parser/shake/add-default-package.xsl", "/org/eolang/parser/shake/explicit-data.xsl", "/org/eolang/parser/shake/set-locators.xsl", - "/org/eolang/parser/shake/clean-up.xsl", - "/org/eolang/parser/shake/remove-refs.xsl", - "/org/eolang/parser/shake/abstracts-float-up.xsl", - "/org/eolang/parser/shake/remove-levels.xsl", - "/org/eolang/parser/shake/add-refs.xsl", - "/org/eolang/parser/shake/fix-missed-names.xsl", - "/org/eolang/parser/shake/add-refs.xsl", - "/org/eolang/parser/shake/set-locators.xsl", "/org/eolang/parser/shake/blank-xsd-schema.xsl" ).back() ) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java index b6c0342a82..f309c5daef 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/TranspileMojo.java @@ -106,11 +106,9 @@ public final class TranspileMojo extends SafeMojo { new TrJoined<>( new TrClasspath<>( "/org/eolang/maven/transpile/classes.xsl", - "/org/eolang/maven/transpile/package.xsl", "/org/eolang/maven/transpile/tests.xsl", - "/org/eolang/maven/transpile/rename-tests-inners.xsl", - "/org/eolang/maven/transpile/align-test-classes.xsl", - "/org/eolang/maven/transpile/remove-high-level-inner-classes.xsl", + "/org/eolang/maven/transpile/anonymous-to-nested.xsl", + "/org/eolang/maven/transpile/package.xsl", "/org/eolang/maven/transpile/attrs.xsl", "/org/eolang/maven/transpile/data.xsl" ).back(), diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java index 20dc3d168c..1c2d32a74b 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java @@ -62,6 +62,7 @@ threadSafe = true ) public final class UnphiMojo extends SafeMojo { + /** * Unphi transformations. */ diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/latex/latex-template.txt b/eo-maven-plugin/src/main/resources/org/eolang/maven/latex/latex-template.txt index 29876f9a2d..3c30a2a875 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/latex/latex-template.txt +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/latex/latex-template.txt @@ -4,4 +4,4 @@ \begin{ffcode} %s \end{ffcode} -\end{document} \ No newline at end of file +\end{document} diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/sodg/_macros.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/sodg/_macros.xsl index d95f988858..47992d3c04 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/sodg/_macros.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/sodg/_macros.xsl @@ -55,9 +55,6 @@ SOFTWARE. - - - Φ diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/align-test-classes.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/align-test-classes.xsl deleted file mode 100644 index 41de4a8e53..0000000000 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/align-test-classes.xsl +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/remove-levels.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/anonymous-to-nested.xsl similarity index 75% rename from eo-parser/src/main/resources/org/eolang/parser/shake/remove-levels.xsl rename to eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/anonymous-to-nested.xsl index 98e8c14c78..21d9ed8d20 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/remove-levels.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/anonymous-to-nested.xsl @@ -22,20 +22,15 @@ 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. --> - - + - + - - - - - - - + + + + + diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/attrs.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/attrs.xsl index 0150672a67..e461cce509 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/attrs.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/attrs.xsl @@ -24,24 +24,48 @@ SOFTWARE. --> - + + + + + + + + + + - + - + bound - + void + + + atom + + + abstract - - - - - + + + + + + + + + + + + + + diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/classes.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/classes.xsl index 252eb7459a..584333a084 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/classes.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/classes.xsl @@ -62,7 +62,7 @@ SOFTWARE. > - + diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/remove-high-level-inner-classes.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/remove-high-level-inner-classes.xsl deleted file mode 100644 index c7947d735e..0000000000 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/remove-high-level-inner-classes.xsl +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/rename-tests-inners.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/rename-tests-inners.xsl deleted file mode 100644 index c3ae78089b..0000000000 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/rename-tests-inners.xsl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - ω - - - -hash- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/tests.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/tests.xsl index 7dd1b93872..de68c317c0 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/tests.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/tests.xsl @@ -28,9 +28,9 @@ SOFTWARE. classes that are unit tests. --> - - - + + + @@ -47,8 +47,8 @@ SOFTWARE. - - + + @@ -56,68 +56,6 @@ SOFTWARE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/to-java.xsl b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/to-java.xsl index 2a2bed2e24..6621656f0a 100644 --- a/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/to-java.xsl +++ b/eo-maven-plugin/src/main/resources/org/eolang/maven/transpile/to-java.xsl @@ -116,14 +116,32 @@ SOFTWARE. - - - - + + + + + + + + + + + + + h + + + + + + + + r + @@ -131,6 +149,8 @@ SOFTWARE. + import java.util.function.Function; + import org.eolang.*; @@ -186,7 +206,34 @@ SOFTWARE. - + + } + + + + + + + private static class + + extends PhDefault { + + /** + + * Ctor. + + */ + + + () { + + + + + + + } + } @@ -203,6 +250,7 @@ SOFTWARE. + /** * Ctor. @@ -210,7 +258,7 @@ SOFTWARE. */ public - + () { @@ -219,11 +267,11 @@ SOFTWARE. () -> { - + - return ret; + return r; } @@ -232,6 +280,8 @@ SOFTWARE. + + @@ -242,14 +292,31 @@ SOFTWARE. + + + + + Unnamed attribute found in + + + - this.add(" + + ((PhDefault) + + + + ) + + .add(" ", - + + + ); @@ -260,59 +327,156 @@ SOFTWARE. ") + + + + + + + + + + + + + + + + + atom + + new AtOnce(new AtComposite( + + , new Function<>() { + + @Override + + public Phi apply(final Phi + + ) { + + Phi + + = new + + (); + + + + + + return + + ; + + } + + })) + + + + + + + + + + new AtOnce(new AtComposite( + + , new Function<>() { + + @Override + + public Phi apply(final Phi + + ) { + + Phi + + = new PhDefault(); + + + + + $ + + + + + + + + + + return + + ; + + } + + })) + - new AtOnce(new AtComposite(this, rho -> { + + + + new AtOnce(new AtComposite( + + , new Function<>() { + + @Override + + public Phi apply(final Phi + + ) { - - + + + + + return + + ; - return ret; + } })) - + - - - Phi + + + PhDefault = - new PhDefault() { - / - * anonymous abstract object without attributes */ }; - + + + new + + + + new PhDefault + + + (); - - - - - - Found more than one target of ' - - ' at the line # - - leading to - - - , - - < - - /> - at line # - - - ; it's an internal bug - - + Phi @@ -323,44 +487,17 @@ SOFTWARE. .copy() - rho + Phi.Φ - new PhMethod(rho, " + + .take(" ") - - - new - - () - - - - - - - new PhMethod( - - rho - - , " - - ") - - , " - - ") - - - new PhMethod(rho, " - - ") - @@ -369,6 +506,7 @@ SOFTWARE. + @@ -379,25 +517,30 @@ SOFTWARE. + + - _base + b + Phi - = new PhMethod( - - _base, " - + = + + b.take(" + new PhMethod( + + b, " @@ -406,6 +549,7 @@ SOFTWARE. + @@ -438,6 +582,7 @@ SOFTWARE. + @@ -452,12 +597,12 @@ SOFTWARE. - _ + @@ -486,7 +631,6 @@ SOFTWARE. , - _ ); diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/ArchitectureTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/ArchitectureTest.java new file mode 100644 index 0000000000..bc0ab2e508 --- /dev/null +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/ArchitectureTest.java @@ -0,0 +1,70 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2016-2025 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; + +import com.tngtech.archunit.core.importer.ClassFileImporter; +import com.tngtech.archunit.lang.syntax.ArchRuleDefinition; +import org.apache.maven.plugins.annotations.Mojo; +import org.junit.jupiter.api.Test; + +/** + * Test case for architectural conventions. + * + * @since 0.51.0 + */ +@SuppressWarnings({ "JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleAssertionMessage" }) +final class ArchitectureTest { + + @Test + void mojosAreInPlace() { + ArchRuleDefinition.classes() + .that().haveSimpleNameEndingWith("Mojo") + .and().doNotHaveSimpleName("SafeMojo") + .should().resideInAPackage("org.eolang.maven") + .andShould().bePublic() + .andShould().beTopLevelClasses() + .check(new ClassFileImporter().importPackages("org.eolang.maven")); + } + + @Test + void mojosHaveOneParent() { + ArchRuleDefinition.classes() + .that().haveSimpleNameEndingWith("Mojo") + .and().doNotHaveSimpleName("SafeMojo") + .should() + .beAssignableTo(SafeMojo.class) + .check(new ClassFileImporter().importPackages("org.eolang.maven")); + } + + @Test + void mojosHaveAnnotation() { + ArchRuleDefinition.classes() + .that().haveSimpleNameEndingWith("Mojo") + .and().doNotHaveSimpleName("SafeMojo") + .should() + .beAnnotatedWith(Mojo.class) + .check(new ClassFileImporter().importPackages("org.eolang.maven")); + } + +} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java index b04078bf79..062421a7f2 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/FakeMaven.java @@ -330,6 +330,7 @@ FakeMaven withHelloWorld() throws IOException { "+alias stdout org.eolang.io.stdout", "+home https://www.eolang.org", "+package foo.x", + "+unlint incorrect-alias", "+version 0.0.0", "", "# No comments here, since it's just an example.", diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java index 61670f7229..c8d0b7d0bf 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/LintMojoTest.java @@ -146,7 +146,7 @@ void detectsCriticalErrorsSuccessfully(@Mktmp final Path temp) throws IOExceptio new XMLDocument( maven.result().get("target/2-shake/foo/x/main.xmir") ).nodes("//errors/error[@severity='critical']"), - Matchers.hasSize(1) + Matchers.hasSize(3) ); } @@ -172,7 +172,7 @@ void detectsWarningWithCorrespondingFlag(@Mktmp final Path temp) throws IOExcept new XMLDocument( maven.result().get("target/6-lint/foo/x/main.xmir") ).nodes("//errors/error[@severity='warning']"), - Matchers.hasSize(Matchers.greaterThanOrEqualTo(6)) + Matchers.hasSize(Matchers.greaterThanOrEqualTo(2)) ); } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java index 2297591f96..2c5abb7822 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoTest.java @@ -108,7 +108,7 @@ void failsOnTimeout(@Mktmp final Path temp) { () -> new FakeMaven(temp) .withHelloWorld() .with("timeout", 0) - .execute(InfiniteMojo.class), + .execute(Infinite.class), CatalogsTest.TO_ADD_MESSAGE ); } @@ -229,7 +229,7 @@ void parsesConcurrentlyWithLotsOfPrograms(@Mktmp final Path temp) throws IOExcep * @since 0.29 */ @Mojo(name = "infinite", defaultPhase = LifecyclePhase.VALIDATE) - private static final class InfiniteMojo extends SafeMojo { + private static final class Infinite extends SafeMojo { @Override public void exec() { try { diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java index 643d71d7b5..09799ac3db 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java @@ -28,10 +28,14 @@ import com.yegor256.MktmpResolver; import com.yegor256.WeAreOnline; import com.yegor256.farea.Farea; +import java.io.File; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.attribute.FileTime; import org.cactoos.text.TextOf; import org.eolang.jucs.ClasspathSource; +import org.eolang.maven.footprint.CachePath; +import org.eolang.maven.footprint.Saved; import org.eolang.xax.XtSticky; import org.eolang.xax.XtYaml; import org.eolang.xax.Xtory; @@ -39,6 +43,7 @@ import org.hamcrest.Matchers; 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.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -46,6 +51,9 @@ /** * Test cases for {@link PhiMojo}. * @since 0.34.0 + * @todo #3708:30min Remove @Disabled annotation on + * {@code PhiMojoTest.usesCache()} and {@code PhiMojoTest.invalidatesCache()} + * when cache is implemented, check that tests is valid otherwise fix them. */ @SuppressWarnings({"PMD.TooManyMethods", "PMD.AvoidDuplicateLiterals"}) @ExtendWith(MktmpResolver.class) @@ -223,4 +231,70 @@ void checksSaltyPhiPacks(final String pack, @Mktmp final Path temp) throws Excep Matchers.equalTo(xtory.map().get("salty").toString()) ); } + + @Test + @Disabled + void usesCache( + @Mktmp final Path temp, + @RandomProgram final String program + ) throws Exception { + final Path cache = temp.resolve("cache"); + final String hash = "123ZaRiFcHiK321"; + final Path cached = new Saved( + "some valid phi from cache", + new CachePath( + cache.resolve(PhiMojo.CACHE), + FakeMaven.pluginVersion(), + hash, + Path.of("foo/x/main.phi") + ).get() + ).value(); + Files.setLastModifiedTime( + cached, + FileTime.fromMillis(System.currentTimeMillis() + 50_000) + ); + MatcherAssert.assertThat( + "Phi is not loaded from cache", + new TextOf( + new FakeMaven(temp) + .with("cache", cache.toFile()) + .withProgram(program) + .allTojosWithHash(() -> hash) + .execute(new FakeMaven.Phi()) + .result() + .get("target/phi/foo/x/main.phi") + ).asString(), + Matchers.equalTo(new TextOf(cached).asString()) + ); + } + + @Test + @Disabled + void invalidatesCache( + @Mktmp final Path temp, + final @RandomProgram String program + ) throws Exception { + final Path cache = temp.resolve("cache"); + final String hash = "123ZaRiFcHiK321"; + final File cached = new Saved( + "some invalid phi (old) from cache", + new CachePath( + cache.resolve(PhiMojo.CACHE), + FakeMaven.pluginVersion(), + hash, + Path.of("foo/x/main.phi") + ).get() + ).value().toFile(); + final long old = cached.lastModified(); + new FakeMaven(temp) + .with("cache", cache.toFile()) + .withProgram(program) + .allTojosWithHash(() -> hash) + .execute(new FakeMaven.Phi()); + MatcherAssert.assertThat( + "PHI cache not invalidated", + old, + Matchers.lessThan(cached.lastModified()) + ); + } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java old mode 100755 new mode 100644 index 89ef29de26..fbc7d318bc --- a/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/TranspileMojoTest.java @@ -40,7 +40,6 @@ import org.cactoos.text.TextOf; import org.eolang.jucs.ClasspathSource; import org.eolang.parser.EoSyntax; -import org.eolang.parser.TrFull; import org.eolang.xax.XtSticky; import org.eolang.xax.XtYaml; import org.eolang.xax.XtoryMatcher; @@ -90,7 +89,7 @@ void checksTranspilePacks(final String yaml) { "scenario", new InputOf(String.format("%s\n", eo)) ).parsed(), - new TrFull() + new TrShaking() ) ), new XtoryMatcher() 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 882778d897..c3a19abc7b 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 @@ -31,6 +31,7 @@ import com.yegor256.MktmpResolver; import com.yegor256.WeAreOnline; import com.yegor256.farea.Farea; +import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -44,6 +45,8 @@ import org.cactoos.set.SetOf; import org.cactoos.text.TextOf; import org.eolang.jucs.ClasspathSource; +import org.eolang.maven.footprint.CachePath; +import org.eolang.maven.footprint.Saved; import org.eolang.maven.util.HmBase; import org.eolang.parser.EoSyntax; import org.eolang.parser.StrictXmir; @@ -54,6 +57,7 @@ import org.hamcrest.Matchers; 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.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -62,7 +66,11 @@ /** * Test cases for {@link UnphiMojo}. * @since 0.34.0 + * @todo #3708:30min Remove @Disabled annotation on + * {@code UnphiMojoTest.usesCache()} and {@code UnphiMojoTest.invalidatesCache()} + * when cache is implemented, check that tests is valid otherwise fix them if needed. */ +@SuppressWarnings("PMD.TooManyMethods") @ExtendWith(MktmpResolver.class) final class UnphiMojoTest { @@ -296,4 +304,71 @@ void convertsValidXmirAndParsableEO(final boolean reversed, @Mktmp final Path te XhtmlMatchers.hasXPath("/program[not(errors)]") ); } + + @Test + @Disabled + void usesCache(@Mktmp final Path temp) throws Exception { + new Saved( + "{⟦std ↦ Φ.org.eolang.io.stdout, y ↦ Φ.org.eolang.x⟧}", + temp.resolve("target/eo/phi/std.phi") + ).value(); + final String hash = "123ZaRiFcHiK321"; + final Path cache = temp.resolve("cache"); + final String expected = "some valid XMIR from cache"; + new Saved( + expected, + new CachePath( + cache.resolve("unphied"), + FakeMaven.pluginVersion(), + hash, + Path.of("std.xmir") + ).get() + ).value(); + MatcherAssert.assertThat( + "XMIR file is not loaded from cache", + new TextOf( + new FakeMaven(temp) + .with("cache", cache.toFile()) + .with("unphiInputDir", temp.resolve("target/eo/phi/").toFile()) + .with("unphiOutputDir", temp.resolve("target/eo/1-parse").toFile()) + .allTojosWithHash(() -> hash) + .execute(UnphiMojo.class) + .result() + .get("target/eo/1-parse/std.xmir") + ).asString(), + Matchers.equalTo(expected) + ); + } + + @Test + @Disabled + void invalidatesCache(@Mktmp final Path temp) throws Exception { + final String hash = "123ZaRiFcHiK321"; + final Path cache = temp.resolve("cache"); + final File cached = new Saved( + "some invalid (old) XMIR from cache", + new CachePath( + cache.resolve("unphied"), + FakeMaven.pluginVersion(), + hash, + Path.of("std.xmir") + ).get() + ).value().toFile(); + new Saved( + "{⟦std ↦ Φ.org.eolang.io.stdout, y ↦ Φ.org.eolang.x⟧}", + temp.resolve("target/eo/phi/std.phi") + ).value(); + final long old = cached.lastModified(); + new FakeMaven(temp) + .with("cache", cache.toFile()) + .with("unphiInputDir", temp.resolve("target/eo/phi/").toFile()) + .with("unphiOutputDir", temp.resolve("target/eo/1-parse").toFile()) + .allTojosWithHash(() -> hash) + .execute(UnphiMojo.class); + MatcherAssert.assertThat( + "XMIR cache not invalidated", + old, + Matchers.lessThan(cached.lastModified()) + ); + } } diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java index b8bb8c823e..e6b185f0a4 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/UnplaceMojoTest.java @@ -301,4 +301,3 @@ private static Stream testArgsProvider() { ); } } - diff --git a/eo-maven-plugin/src/test/resources/log4j.properties b/eo-maven-plugin/src/test/resources/log4j.properties index 190461ca3c..688203f165 100644 --- a/eo-maven-plugin/src/test/resources/log4j.properties +++ b/eo-maven-plugin/src/test/resources/log4j.properties @@ -27,6 +27,7 @@ log4j.appender.CONSOLE.layout=com.jcabi.log.MulticolorLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss} [%p] %c: %m%n log4j.logger.org.eolang=INFO +log4j.logger.org.eolang.maven.log.Logs=INFO log4j.logger.com.yegor256.Jaxec=WARN log4j.logger.com.yegor256.farea=WARN log4j.logger.org.eolang.parser.Syntax=WARN diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/binarize/wrong-rust.eo b/eo-maven-plugin/src/test/resources/org/eolang/maven/binarize/wrong-rust.eo index 308a7ceb5b..108a3b0fc9 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/binarize/wrong-rust.eo +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/binarize/wrong-rust.eo @@ -41,4 +41,3 @@ "rand= \"0.5.5\"" "nonexistent = -5" true > @ - diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/commits/tags.txt b/eo-maven-plugin/src/test/resources/org/eolang/maven/commits/tags.txt index fd6ba05ff0..12df570130 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/commits/tags.txt +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/commits/tags.txt @@ -17,4 +17,4 @@ cc554ab82909eebbfdacd8a840f9cf42a99b64cf 0.27.0 9c9352890b5d30e1b89c9147e7c95a90c9b8709f 0.28.5 17f89293e5ae6115e9a0234b754b22918c11c602 0.28.6 5f82cc1edffad67bf4ba816610191403eb18af5d 0.28.7 -be83d9adda4b7c9e670e625fe951c80f3ead4177 0.28.9 \ No newline at end of file +be83d9adda4b7c9e670e625fe951c80f3ead4177 0.28.9 diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-transient-dependency.json b/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-transient-dependency.json index 6c239f51d6..36d6655545 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-transient-dependency.json +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-transient-dependency.json @@ -1,31 +1,47 @@ { - "graphName" : "eo-math", - "artifacts" : [ { - "id" : "org.eolang:eo-math:jar", - "numericId" : 1, - "groupId" : "org.eolang", - "artifactId" : "eo-math", - "version" : "0.2.3", - "optional" : false, - "scopes" : [ "compile" ], - "types" : [ "jar" ] - }, { - "id" : "org.eolang:eo-runtime:jar", - "numericId" : 2, - "groupId" : "org.eolang", - "artifactId" : "eo-runtime", - "version" : "0.28.0", - "optional" : false, - "scopes" : [ "compile" ], - "types" : [ "jar" ] - }, { - "id" : "org.junit.jupiter:junit-jupiter-api:jar", - "numericId" : 3, - "groupId" : "org.junit.jupiter", - "artifactId" : "junit-jupiter-api", - "version" : "5.9.0", - "optional" : false, - "scopes" : [ "compile" ], - "types" : [ "jar" ] - }] -} \ No newline at end of file + "artifacts": [ + { + "artifactId": "eo-math", + "groupId": "org.eolang", + "id": "org.eolang:eo-math:jar", + "numericId": 1, + "optional": false, + "scopes": [ + "compile" + ], + "types": [ + "jar" + ], + "version": "0.2.3" + }, + { + "artifactId": "eo-runtime", + "groupId": "org.eolang", + "id": "org.eolang:eo-runtime:jar", + "numericId": 2, + "optional": false, + "scopes": [ + "compile" + ], + "types": [ + "jar" + ], + "version": "0.28.0" + }, + { + "artifactId": "junit-jupiter-api", + "groupId": "org.junit.jupiter", + "id": "org.junit.jupiter:junit-jupiter-api:jar", + "numericId": 3, + "optional": false, + "scopes": [ + "compile" + ], + "types": [ + "jar" + ], + "version": "5.9.0" + } + ], + "graphName": "eo-math" +} diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-without-foreign.json b/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-without-foreign.json index bd89de04db..f442b452a9 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-without-foreign.json +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/dependencies/eo-math-dependencies-without-foreign.json @@ -1,104 +1,147 @@ { - "graphName" : "eo-math", - "artifacts" : [ { - "id" : "org.eolang:eo-math:jar", - "numericId" : 1, - "groupId" : "org.eolang", - "artifactId" : "eo-math", - "version" : "0.2.3", - "optional" : false, - "scopes" : [ "compile" ], - "types" : [ "jar" ] - }, { - "id" : "org.eolang:eo-runtime:jar", - "numericId" : 2, - "groupId" : "org.eolang", - "artifactId" : "eo-runtime", - "version" : "0.28.0", - "optional" : false, - "scopes" : [ "compile" ], - "types" : [ "jar" ] - }, { - "id" : "org.junit.jupiter:junit-jupiter-api:jar", - "numericId" : 3, - "groupId" : "org.junit.jupiter", - "artifactId" : "junit-jupiter-api", - "version" : "5.9.0", - "optional" : false, - "scopes" : [ "test" ], - "types" : [ "jar" ] - }, { - "id" : "org.opentest4j:opentest4j:jar", - "numericId" : 4, - "groupId" : "org.opentest4j", - "artifactId" : "opentest4j", - "version" : "1.2.0", - "optional" : false, - "scopes" : [ "test" ], - "types" : [ "jar" ] - }, { - "id" : "org.junit.platform:junit-platform-commons:jar", - "numericId" : 5, - "groupId" : "org.junit.platform", - "artifactId" : "junit-platform-commons", - "version" : "1.9.0", - "optional" : false, - "scopes" : [ "test" ], - "types" : [ "jar" ] - }, { - "id" : "org.apiguardian:apiguardian-api:jar", - "numericId" : 6, - "groupId" : "org.apiguardian", - "artifactId" : "apiguardian-api", - "version" : "1.1.2", - "optional" : false, - "scopes" : [ "test" ], - "types" : [ "jar" ] - }, { - "id" : "org.junit.jupiter:junit-jupiter-params:jar", - "numericId" : 7, - "groupId" : "org.junit.jupiter", - "artifactId" : "junit-jupiter-params", - "version" : "5.9.0", - "optional" : false, - "scopes" : [ "test" ], - "types" : [ "jar" ] - } ], - "dependencies" : [ { - "from" : "org.eolang:eo-math:jar", - "to" : "org.eolang:eo-runtime:jar", - "numericFrom" : 0, - "numericTo" : 1, - "resolution" : "INCLUDED" - }, { - "from" : "org.junit.jupiter:junit-jupiter-api:jar", - "to" : "org.opentest4j:opentest4j:jar", - "numericFrom" : 2, - "numericTo" : 3, - "resolution" : "INCLUDED" - }, { - "from" : "org.junit.jupiter:junit-jupiter-api:jar", - "to" : "org.junit.platform:junit-platform-commons:jar", - "numericFrom" : 2, - "numericTo" : 4, - "resolution" : "INCLUDED" - }, { - "from" : "org.junit.jupiter:junit-jupiter-api:jar", - "to" : "org.apiguardian:apiguardian-api:jar", - "numericFrom" : 2, - "numericTo" : 5, - "resolution" : "INCLUDED" - }, { - "from" : "org.eolang:eo-math:jar", - "to" : "org.junit.jupiter:junit-jupiter-api:jar", - "numericFrom" : 0, - "numericTo" : 2, - "resolution" : "INCLUDED" - }, { - "from" : "org.eolang:eo-math:jar", - "to" : "org.junit.jupiter:junit-jupiter-params:jar", - "numericFrom" : 0, - "numericTo" : 6, - "resolution" : "INCLUDED" - } ] -} \ No newline at end of file + "artifacts": [ + { + "artifactId": "eo-math", + "groupId": "org.eolang", + "id": "org.eolang:eo-math:jar", + "numericId": 1, + "optional": false, + "scopes": [ + "compile" + ], + "types": [ + "jar" + ], + "version": "0.2.3" + }, + { + "artifactId": "eo-runtime", + "groupId": "org.eolang", + "id": "org.eolang:eo-runtime:jar", + "numericId": 2, + "optional": false, + "scopes": [ + "compile" + ], + "types": [ + "jar" + ], + "version": "0.28.0" + }, + { + "artifactId": "junit-jupiter-api", + "groupId": "org.junit.jupiter", + "id": "org.junit.jupiter:junit-jupiter-api:jar", + "numericId": 3, + "optional": false, + "scopes": [ + "test" + ], + "types": [ + "jar" + ], + "version": "5.9.0" + }, + { + "artifactId": "opentest4j", + "groupId": "org.opentest4j", + "id": "org.opentest4j:opentest4j:jar", + "numericId": 4, + "optional": false, + "scopes": [ + "test" + ], + "types": [ + "jar" + ], + "version": "1.2.0" + }, + { + "artifactId": "junit-platform-commons", + "groupId": "org.junit.platform", + "id": "org.junit.platform:junit-platform-commons:jar", + "numericId": 5, + "optional": false, + "scopes": [ + "test" + ], + "types": [ + "jar" + ], + "version": "1.9.0" + }, + { + "artifactId": "apiguardian-api", + "groupId": "org.apiguardian", + "id": "org.apiguardian:apiguardian-api:jar", + "numericId": 6, + "optional": false, + "scopes": [ + "test" + ], + "types": [ + "jar" + ], + "version": "1.1.2" + }, + { + "artifactId": "junit-jupiter-params", + "groupId": "org.junit.jupiter", + "id": "org.junit.jupiter:junit-jupiter-params:jar", + "numericId": 7, + "optional": false, + "scopes": [ + "test" + ], + "types": [ + "jar" + ], + "version": "5.9.0" + } + ], + "dependencies": [ + { + "from": "org.eolang:eo-math:jar", + "numericFrom": 0, + "numericTo": 1, + "resolution": "INCLUDED", + "to": "org.eolang:eo-runtime:jar" + }, + { + "from": "org.junit.jupiter:junit-jupiter-api:jar", + "numericFrom": 2, + "numericTo": 3, + "resolution": "INCLUDED", + "to": "org.opentest4j:opentest4j:jar" + }, + { + "from": "org.junit.jupiter:junit-jupiter-api:jar", + "numericFrom": 2, + "numericTo": 4, + "resolution": "INCLUDED", + "to": "org.junit.platform:junit-platform-commons:jar" + }, + { + "from": "org.junit.jupiter:junit-jupiter-api:jar", + "numericFrom": 2, + "numericTo": 5, + "resolution": "INCLUDED", + "to": "org.apiguardian:apiguardian-api:jar" + }, + { + "from": "org.eolang:eo-math:jar", + "numericFrom": 0, + "numericTo": 2, + "resolution": "INCLUDED", + "to": "org.junit.jupiter:junit-jupiter-api:jar" + }, + { + "from": "org.eolang:eo-math:jar", + "numericFrom": 0, + "numericTo": 6, + "resolution": "INCLUDED", + "to": "org.junit.jupiter:junit-jupiter-params:jar" + } + ], + "graphName": "eo-math" +} diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo index a7cb8ce5a7..8cce0e0fc2 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo @@ -27,6 +27,7 @@ +tests +package org.eolang.examples +version 0.0.0 ++unlint broken-ref 3.14 > pi diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/abstracts.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/abstracts.yaml index 1339d7f12a..3ec1879d8c 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/abstracts.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/abstracts.yaml @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- +skip: true locators: - .org .eolang .number - .foo .bar .a .x .α0 .α0 .Δ δ=40-45-00-00-00-00-00-00 diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/arrays.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/arrays.yaml index 967d06f473..b7c007d55b 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/arrays.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/arrays.yaml @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- +skip: true locators: - .org .eolang .test - .org .eolang .number diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/atoms.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/atoms.yaml index 12c0064722..462303e69e 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/atoms.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/atoms.yaml @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- +skip: true locators: - .foo .boom .λ τ=foo.boom - .foo .hello$alpha .λ τ=foo.hello$alpha diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/dots.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/dots.yaml index b5c6b4c22b..18592acc53 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/dots.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/dots.yaml @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- +skip: true locators: - .org .eolang .true - .org .eolang .true !.not diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/refs.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/refs.yaml index 22f0be5008..ea14206064 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/refs.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/sodgs/refs.yaml @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. --- +skip: true locators: - .refs .x .ε - .org .eolang .true diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bindings-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bindings-to-java.yaml index 5b4d220a5a..7b3179b3cb 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bindings-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bindings-to-java.yaml @@ -21,15 +21,14 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - //java/text()[contains(., 'new PhWith(ret, 0')] - - //java/text()[contains(., 'new PhWith(ret, "text"')] + - //java/text()[contains(., 'new PhWith(r, 0')] + - //java/text()[contains(., 'new PhWith(r, "text"')] input: | # No comments. [] > main diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bound-globals-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bound-globals-to-java.yaml index 5e305219b4..20d3cc4f7b 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bound-globals-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/bound-globals-to-java.yaml @@ -21,29 +21,8 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/expand-qqs.xsl - - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - - /org/eolang/parser/shake/expand-aliases.xsl - - /org/eolang/parser/shake/resolve-aliases.xsl - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/explicit-data.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/package.xsl - - /org/eolang/maven/transpile/tests.xsl - - /org/eolang/maven/transpile/rename-tests-inners.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl @@ -53,7 +32,7 @@ asserts: - //java[contains(text(), ' public EOmain() {')] - //java[contains(text(), ' super(')] - //java[contains(text(), ' () -> {')] - - //java[contains(text(), ' return ret;')] + - //java[contains(text(), ' return r;')] input: | stdout > main "Hello" diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/converts-to-java-with-arrays-and-scopes.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/converts-to-java-with-arrays-and-scopes.yaml index db5ee1c586..0c4336ce7c 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/converts-to-java-with-arrays-and-scopes.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/converts-to-java-with-arrays-and-scopes.yaml @@ -25,29 +25,8 @@ # Pay attention and to-java.xsl transformations. --- sheets: - - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/expand-qqs.xsl - - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - - /org/eolang/parser/shake/expand-aliases.xsl - - /org/eolang/parser/shake/resolve-aliases.xsl - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/explicit-data.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/package.xsl - - /org/eolang/maven/transpile/tests.xsl - - /org/eolang/maven/transpile/rename-tests-inners.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/data-as-bytes.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/data-as-bytes.yaml index adc470a6e1..d84d2a7cdf 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/data-as-bytes.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/data-as-bytes.yaml @@ -21,9 +21,6 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/explicit-data.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl @@ -31,10 +28,10 @@ sheets: asserts: - /program[not(errors)] - //java[contains(text(), '.take("org").take("eolang").take("true")')] - - //java[contains(text(), 'ret_1 = new PhWith(ret_1, 0, new PhDefault(new byte[] {(byte) 0x00}));')] - - //java[contains(text(), 'ret_1 = new PhWith(ret_1, 0, new PhDefault(new byte[] {(byte) 0x40, (byte) 0x45, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));')] - - //java[contains(text(), 'ret_1 = new PhWith(ret_1, 0, new PhDefault(new byte[] {(byte) 0x40, (byte) 0x0C, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));')] - - //java[contains(text(), 'ret = new PhWith(ret, 0, new PhDefault(new byte[] {(byte) 0x01, (byte) 0xAF}));')] + - //java[contains(text(), 'r1 = new PhWith(r1, 0, new PhDefault(new byte[] {(byte) 0x00}));')] + - //java[contains(text(), 'r1 = new PhWith(r1, 0, new PhDefault(new byte[] {(byte) 0x40, (byte) 0x45, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));')] + - //java[contains(text(), 'r1 = new PhWith(r1, 0, new PhDefault(new byte[] {(byte) 0x40, (byte) 0x0C, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00}));')] + - //java[contains(text(), 'r = new PhWith(r, 0, new PhDefault(new byte[] {(byte) 0x01, (byte) 0xAF}));')] input: | # No comments. [] > t diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/embedded-class.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/embedded-class.yaml index 67c9bfa699..f75fcc2e63 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/embedded-class.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/embedded-class.yaml @@ -21,20 +21,19 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - //java[contains(text(), 'PhMethod(new PhMethod(rho, "ρ"), "ρ")')] + - //java[contains(text(), 'this.add("xyz",')] + - //java[contains(text(), '((PhDefault) r).add("bar",')] + - //java[contains(text(), '((PhDefault) rr).add("φ",')] + - //java[contains(text(), 'Phi rrrbbb = rrh.take("ρ")')] + - //java[contains(text(), 'Phi rrrbb = rrrbbb.take("ρ")')] + - //java[contains(text(), 'Phi rrrb = new PhMethod(rrrbb, "this")')] + - //java[contains(text(), 'Phi rrr = new PhMethod(rrrb, "x")')] input: | # No comments. [x] > foo diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/locators-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/locators-to-java.yaml index 1ceb845293..a0b0a921ed 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/locators-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/locators-to-java.yaml @@ -21,24 +21,20 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/explicit-data.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - //java[contains(text(), 'new PhSafe(ret, "scenario", 3, 2, "Φ.foo.φ")')] - - //java[contains(text(), 'new PhSafe(ret_base, "scenario", 6, 4, "Φ.foo.other.φ.ρ")')] - - //java[contains(text(), 'new PhSafe(ret, "scenario", 6, 6, "Φ.foo.other.φ")')] - - //java[contains(text(), 'new PhSafe(ret_1, "scenario", 6, 12, "Φ.foo.other.φ.α0")')] - - //java[contains(text(), 'new PhSafe(ret_base, "scenario", 10, 2, "Φ.bar.φ.ρ")')] - - //java[contains(text(), 'new PhSafe(ret, "scenario", 10, 4, "Φ.bar.φ")')] - - //java[contains(text(), 'new PhSafe(ret_1, "scenario", 10, 10, "Φ.bar.φ.α0")')] - - //java[contains(text(), 'new PhSafe(ret, "scenario", 11, 2, "Φ.bar.five")')] + - //java[contains(text(), 'new PhSafe(r, "scenario", 3, 2, "Φ.foo.φ")')] + - //java[contains(text(), 'new PhSafe(rrb, "scenario", 6, 4, "Φ.foo.other.φ.ρ")')] + - //java[contains(text(), 'new PhSafe(rr, "scenario", 6, 6, "Φ.foo.other.φ")')] + - //java[contains(text(), 'new PhSafe(rr1, "scenario", 6, 12, "Φ.foo.other.φ.α0")')] + - //java[contains(text(), 'new PhSafe(rb, "scenario", 10, 2, "Φ.bar.φ.ρ")')] + - //java[contains(text(), 'new PhSafe(r, "scenario", 10, 4, "Φ.bar.φ")')] + - //java[contains(text(), 'new PhSafe(r1, "scenario", 10, 10, "Φ.bar.φ.α0")')] + - //java[contains(text(), 'new PhSafe(r, "scenario", 11, 2, "Φ.bar.five")')] input: | # No comments. [] > foo diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/long-class-name.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/long-class-name.yaml index dd0d448356..f15887f68d 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/long-class-name.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/long-class-name.yaml @@ -21,17 +21,15 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - //java[contains(text(), 'public final class EOtest$EOblah0$EOblah1$EO89_58 extends PhDefault')] - - //java[contains(text(), 'public final class EOtest$EOblah0$EOblah1$EOblah2$EOblah3$EOblah4$EOblah5$EOblah6$EOblah7$EOblah8$EOblah9$EOblah10$EOblah11$EOblah12$EOblah13$EOblah14$EOblah15$EOblah16$EOblah17$EOblah18$EOblah19$EOblah20$EOblah21$EOblah22$EOblah23$EOblah24$EOblah25$EOblah26$EOblah27 extends PhDefault')] + - //java[contains(text(), 'public final class EOtest extends PhDefault')] + - //java[contains(text(), 'Phi rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr = new PhDefault();')] + - //java[contains(text(), '((PhDefault) rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr).add("blah39"')] input: | # No comments. [] > test diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/set-package.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/set-package.yaml index ccd8d86935..4f51c926e5 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/set-package.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/set-package.yaml @@ -21,7 +21,6 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/package.xsl asserts: diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/synthetic-attributes-with-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/synthetic-attributes-with-to-java.yaml deleted file mode 100644 index 059e39f289..0000000000 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/synthetic-attributes-with-to-java.yaml +++ /dev/null @@ -1,68 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. -# Current test shows optimization and transpilation chain for simple program. -# The aim of this test is to check that entire pipeline with -# scoped objects works as expected without creating any warnings or errors. -# Pay attention to to-java.xsl transformations. ---- -sheets: - - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/expand-qqs.xsl - - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - - /org/eolang/parser/shake/expand-aliases.xsl - - /org/eolang/parser/shake/resolve-aliases.xsl - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/explicit-data.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - - /org/eolang/maven/transpile/classes.xsl - - /org/eolang/maven/transpile/package.xsl - - /org/eolang/maven/transpile/tests.xsl - - /org/eolang/maven/transpile/rename-tests-inners.xsl - - /org/eolang/maven/transpile/attrs.xsl - - /org/eolang/maven/transpile/data.xsl - - /org/eolang/maven/transpile/to-java.xsl -asserts: - - /program[not(errors)] -input: | - +architect volodya.lombrozo@gmail.com - +home https://github.com/objectionary/eo - +tests - +package org.eolang - +version 0.0.0 - - # No comments. - [] > method - * 1 (* "one" "two") 3 > res - eq > @ - * res.length ((res.at 1).at 1) - * 3 "two" diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/test-object-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/test-object-to-java.yaml index a8ddd40c23..861d3a3eb0 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/test-object-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/test-object-to-java.yaml @@ -21,8 +21,6 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-test.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-test.yaml index e8cdd7880e..50bfb027cf 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-test.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-test.yaml @@ -21,20 +21,16 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl + - /org/eolang/maven/transpile/tests.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - //java[contains(text(), '@Test')] + - //java[contains(text(), 'EOworksTest')] + - //java[contains(text(), 'EOthrows_onTest')] - //java[contains(text(), 'Assertions.assertThrows(Exception.class, () -> {')] input: | +tests diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-moving-inside.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-with-abstracts.yaml similarity index 52% rename from eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-moving-inside.yaml rename to eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-with-abstracts.yaml index 4692add418..402119ad23 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-moving-inside.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tests-with-abstracts.yaml @@ -21,21 +21,24 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - /org/eolang/maven/transpile/classes.xsl - - /org/eolang/parser/shake/remove-noise.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - - /org/eolang/maven/transpile/tests.xsl - - /org/eolang/maven/transpile/align-test-classes.xsl - - /org/eolang/maven/transpile/remove-high-level-inner-classes.xsl - - /org/eolang/maven/transpile/rename-tests-inners.xsl + - /org/eolang/maven/transpile/anonymous-to-nested.xsl + - /org/eolang/maven/transpile/attrs.xsl + - /org/eolang/maven/transpile/data.xsl + - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - /program/objects[count(class)=1] - - /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'] + - /program/objects/class/java[contains(text(), 'this.add("b"')] + - /program/objects/class/java[contains(text(), '((PhDefault) r).add("c",')] + - /program/objects/class/java[contains(text(), '((PhDefault) rr).add("φ",')] + - /program/objects/class/java[contains(text(), 'public void works() throws java.lang.Exception')] + - /program/objects/class/java[contains(text(), 'private static class EOΦabcφα0')] + - /program/objects/class/java[contains(text(), 'PhDefault r1 = new EOΦabcφα0boundα0();')] + - /program/objects/class/java[contains(text(), 'private static class EOΦabcφα0boundα0 extends PhDefault')] + - /program/objects/class/java[contains(text(), 'private static class EOΦabcφα1 extends PhDefault')] + - /program/objects/class/java[contains(text(), 'PhDefault rrr1 = new EOΦabcφα0();')] + - /program/objects/class/java[contains(text(), 'PhDefault rrr2 = new EOΦabcφα1();')] + - /program/objects/class/java[contains(text(), 'PhDefault rrr3 = new PhDefault();')] input: | +tests @@ -48,5 +51,9 @@ input: | d > @ [] c > @ + [] > named + x > bound + [] + [] > y + 42 > [] [] - 42 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-noname-abstracts.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/to-java-without-refs.yaml similarity index 65% rename from eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-noname-abstracts.yaml rename to eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/to-java-without-refs.yaml index 89693e2839..8a32735d62 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-noname-abstracts.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/to-java-without-refs.yaml @@ -21,12 +21,32 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/maven/transpile/classes.xsl + - /org/eolang/maven/transpile/package.xsl + - /org/eolang/maven/transpile/attrs.xsl + - /org/eolang/maven/transpile/data.xsl + - /org/eolang/maven/transpile/to-java.xsl asserts: - - /program/objects[count(o)=2] + - /program[not(errors)] input: | # No comments. - [x] > foo - bar > @ - zzz 42 > [t] + [void-attr] > object + 5.plus 5 > bound-attr + + [] > atom /org.eolang.string + + [] > abstract-object + [] > inner-atom /obj + [] > inner-abstract + if. > @ + true > some + false > body + [] > abstract-as-arg + void-attr > @ + 5 + [] > arg + [] + + # No comments. + [] > more-object + 10 > num diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tuple-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tuple-to-java.yaml index c457d10d27..47120624e0 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tuple-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/tuple-to-java.yaml @@ -21,23 +21,19 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl - /org/eolang/maven/transpile/to-java.xsl asserts: - /program[not(errors)] - - //java[contains(text(), 'Phi ret = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_1 = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_1_1 = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_1_1_1_base = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_1_1_1 = new PhMethod(ret_1_1_1_base, "empty");')] - - //java[contains(text(), ' Phi ret_2 = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_2_1 = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_2_1_1_base = Phi.Φ.take("org").take("eolang").take("tuple");')] - - //java[contains(text(), ' Phi ret_2_1_1 = new PhMethod(ret_2_1_1_base, "empty");')] + - //java[contains(text(), ' Phi rbbbb = Phi.Φ.take("org").take("eolang").take("tuple");')] + - //java[contains(text(), ' Phi rbbb = new PhMethod(rbbbb, "empty");')] + - //java[contains(text(), ' Phi rbbb = new PhMethod(rbbbb, "empty");')] + - //java[contains(text(), ' rbb = new PhWith(rbb, 0, rbb1);')] + - //java[contains(text(), ' Phi rb = new PhMethod(rbb, "with");')] + - //java[contains(text(), ' rb = new PhWith(rb, 0, rb1);')] + - //java[contains(text(), ' Phi r = new PhMethod(rb, "with");')] input: | # No comments. [] > foo diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/underscore-to-java.yaml b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/underscore-to-java.yaml index 715af3f88b..113acd70b9 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/underscore-to-java.yaml +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/transpile-packs/underscore-to-java.yaml @@ -21,8 +21,6 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl - /org/eolang/maven/transpile/classes.xsl - /org/eolang/maven/transpile/attrs.xsl - /org/eolang/maven/transpile/data.xsl diff --git a/eo-parser/.gitignore b/eo-parser/.gitignore index 6bca335545..e8e450bed8 100644 --- a/eo-parser/.gitignore +++ b/eo-parser/.gitignore @@ -1 +1 @@ -gen/ \ No newline at end of file +gen/ diff --git a/eo-parser/README.md b/eo-parser/README.md index 85f26e9e8b..eb81a2dffa 100644 --- a/eo-parser/README.md +++ b/eo-parser/README.md @@ -47,7 +47,6 @@ Considering the following `yaml` file: ```yaml sheets: - - /org/eolang/parser/add-refs.xsl - /org/eolang/parser/expand-aliases.xsl - /org/eolang/parser/resolve-aliases.xsl - /org/eolang/parser/add-default-package.xsl @@ -88,7 +87,6 @@ and the `eo` section is used for defining aliases and the main function. This section is used to define the XSLT stylesheets that will be used for transforming the input program. The following stylesheets are defined in this section: -- `/org/eolang/parser/add-refs.xsl`: This stylesheet is used to add references to the program. - `/org/eolang/parser/expand-aliases.xsl`: This stylesheet is used to expand aliases in the program. - `/org/eolang/parser/resolve-aliases.xsl`: This stylesheet is used to resolve aliases in the program. diff --git a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 index 5d4199b4ac..e2414119e3 100644 --- a/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 +++ b/eo-parser/src/main/antlr4/org/eolang/parser/Eo.g4 @@ -47,7 +47,7 @@ metas // Objects // Ends on the next line objects - : (object EOL?)* object + : (object EOL?)+ ; comment diff --git a/eo-parser/src/main/java/org/eolang/parser/EoParserErrors.java b/eo-parser/src/main/java/org/eolang/parser/EoParserErrors.java index cfe8c78ac9..593a346681 100644 --- a/eo-parser/src/main/java/org/eolang/parser/EoParserErrors.java +++ b/eo-parser/src/main/java/org/eolang/parser/EoParserErrors.java @@ -69,8 +69,14 @@ private EoParserErrors(final List errors, final Lines lines) { this.lines = lines; } - // @checkstyle ParameterNumberCheck (10 lines) + // @checkstyle ParameterNumberCheck (20 lines) + // @checkstyle CyclomaticComplexityCheck (100 lines) + // @todo #3744:30min Simplify {@link EoParserErrors#syntaxError} method. + // The method is too complex and has a high cognitive complexity. We need to simplify it. + // Don't forget to remove the @checkstyle CyclomaticComplexityCheck annotation and + // the @SuppressWarnings("PMD.CognitiveComplexity") annotation. @Override + @SuppressWarnings("PMD.CognitiveComplexity") public void syntaxError( final Recognizer recognizer, final Object symbol, @@ -87,18 +93,22 @@ public void syntaxError( ); } final List msgs = new ArrayList<>(0); - if (error instanceof NoViableAltException || error instanceof InputMismatchException) { + if (error instanceof NoViableAltException) { final Token token = (Token) symbol; final Parser parser = (Parser) recognizer; final String rule = parser.getRuleInvocationStack().get(0); final String[] names = parser.getRuleNames(); final String detailed; if (names[EoParser.RULE_objects].equals(rule)) { - detailed = "Invalid object declaration"; + detailed = "Invalid object list declaration"; } else if (names[EoParser.RULE_metas].equals(rule)) { detailed = "Invalid meta declaration"; } else if (names[EoParser.RULE_program].equals(rule)) { detailed = "Invalid program declaration"; + } else if (names[EoParser.RULE_slave].equals(rule)) { + detailed = "Invalid objects declaration that may be used inside abstract object"; + } else if (names[EoParser.RULE_object].equals(rule)) { + detailed = "Invalid object declaration"; } else { detailed = "no viable alternative at input"; } @@ -110,6 +120,29 @@ public void syntaxError( Math.max(token.getStopIndex() - token.getStartIndex(), 1) ).formatted() ); + } else if (error instanceof InputMismatchException) { + final Token token = (Token) symbol; + final Parser parser = (Parser) recognizer; + final String rule = parser.getRuleInvocationStack().get(0); + final String detailed; + final String[] names = parser.getRuleNames(); + if (names[EoParser.RULE_program].equals(rule)) { + detailed = + "We expected the program to end here but encountered something unexpected"; + } else if (names[EoParser.RULE_objects].equals(rule)) { + detailed = + "We expected a list of objects here but encountered something unexpected"; + } else { + detailed = msg; + } + msgs.add(new MsgLocated(line, position, detailed).formatted()); + msgs.add( + new MsgUnderlined( + this.lines.line(line), + position, + Math.max(token.getStopIndex() - token.getStartIndex(), 1) + ).formatted() + ); } else { msgs.add(new MsgLocated(line, position, msg).formatted()); msgs.add(this.lines.line(line)); diff --git a/eo-parser/src/main/java/org/eolang/parser/Lines.java b/eo-parser/src/main/java/org/eolang/parser/Lines.java index 8919b49f53..3f607f41db 100644 --- a/eo-parser/src/main/java/org/eolang/parser/Lines.java +++ b/eo-parser/src/main/java/org/eolang/parser/Lines.java @@ -61,6 +61,6 @@ String line(final int number) { .map(UncheckedText::new) .map(UncheckedText::asString); } - return result.orElse("EOF"); + return result.orElse(""); } } diff --git a/eo-parser/src/main/java/org/eolang/parser/StUnhex.java b/eo-parser/src/main/java/org/eolang/parser/StUnhex.java index ce80ef6de2..8e1759a80c 100644 --- a/eo-parser/src/main/java/org/eolang/parser/StUnhex.java +++ b/eo-parser/src/main/java/org/eolang/parser/StUnhex.java @@ -162,4 +162,3 @@ private static Iterable append(final String after) { return new Directives().set(after); } } - diff --git a/eo-parser/src/main/java/org/eolang/parser/StXPath.java b/eo-parser/src/main/java/org/eolang/parser/StXPath.java index cd8bba2863..adfa6111b9 100644 --- a/eo-parser/src/main/java/org/eolang/parser/StXPath.java +++ b/eo-parser/src/main/java/org/eolang/parser/StXPath.java @@ -87,4 +87,3 @@ public XML apply(final int position, final XML xml) { } } - diff --git a/eo-parser/src/main/java/org/eolang/parser/TrCanonical.java b/eo-parser/src/main/java/org/eolang/parser/TrCanonical.java index e0fff33a8e..d1bb8379b7 100644 --- a/eo-parser/src/main/java/org/eolang/parser/TrCanonical.java +++ b/eo-parser/src/main/java/org/eolang/parser/TrCanonical.java @@ -23,12 +23,8 @@ */ package org.eolang.parser; -import com.yegor256.xsline.StClasspath; -import com.yegor256.xsline.StEndless; import com.yegor256.xsline.TrClasspath; -import com.yegor256.xsline.TrDefault; import com.yegor256.xsline.TrEnvelope; -import com.yegor256.xsline.TrJoined; /** * Train of XSL shifts that turn XMIR into canonical one. @@ -42,24 +38,14 @@ final class TrCanonical extends TrEnvelope { TrCanonical() { super( new TrFull( - new TrJoined<>( - new TrClasspath<>( - "/org/eolang/parser/parse/move-voids-up.xsl", - "/org/eolang/parser/parse/validate-before-stars.xsl", - "/org/eolang/parser/parse/resolve-before-star.xsl" - ).back(), - new TrDefault<>( - new StEndless( - new StClasspath( - "/org/eolang/parser/parse/stars-to-tuples.xsl" - ) - ) - ), - new TrClasspath<>( - "/org/eolang/parser/parse/wrap-method-calls.xsl", - "/org/eolang/parser/parse/const-to-dataized.xsl" - ).back() - ) + new TrClasspath<>( + "/org/eolang/parser/parse/move-voids-up.xsl", + "/org/eolang/parser/parse/validate-before-stars.xsl", + "/org/eolang/parser/parse/resolve-before-star.xsl", + "/org/eolang/parser/parse/wrap-method-calls.xsl", + "/org/eolang/parser/parse/const-to-dataized.xsl", + "/org/eolang/parser/parse/stars-to-tuples.xsl" + ).back() ) ); } diff --git a/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java b/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java index 8e9a7369da..2eecc3c489 100644 --- a/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java +++ b/eo-parser/src/main/java/org/eolang/parser/XeEoListener.java @@ -280,11 +280,16 @@ public void exitJustNamed(final EoParser.JustNamedContext ctx) { } @Override - @SuppressWarnings("PMD.ConfusingTernary") public void enterAtom(final EoParser.AtomContext ctx) { - this.startObject(ctx) - .prop("atom", ctx.type().typeFqn().getText()) - .leave(); + final EoParser.TypeFqnContext fqn = ctx.type().typeFqn(); + if (fqn == null) { + this.errors.add(XeEoListener.error(ctx, "Atom must have a type")); + this.startObject(ctx).leave(); + } else { + this.startObject(ctx) + .prop("atom", fqn.getText()) + .leave(); + } } @Override @@ -1256,7 +1261,7 @@ private static String trimMargin(final String text, final int indent) { * Create parsing exception from given context. * @param ctx Context * @param msg Error message - * @return Parsing exception from current context + * @return Parsing exception from the current context */ private static ParsingException error(final ParserRuleContext ctx, final String msg) { return new ParsingException( diff --git a/eo-parser/src/main/java/org/eolang/parser/Xmir.java b/eo-parser/src/main/java/org/eolang/parser/Xmir.java index 5b6c2e9254..ec77874650 100644 --- a/eo-parser/src/main/java/org/eolang/parser/Xmir.java +++ b/eo-parser/src/main/java/org/eolang/parser/Xmir.java @@ -81,9 +81,9 @@ public final class Xmir implements XML { */ private static final Train FOR_PHI = new TrFull( new TrClasspath<>( - "/org/eolang/parser/shake/add-refs.xsl", - "/org/eolang/parser/shake/expand-qqs.xsl", "/org/eolang/parser/shake/vars-float-up.xsl", + "/org/eolang/parser/shake/build-fqns.xsl", + "/org/eolang/parser/shake/expand-qqs.xsl", "/org/eolang/parser/shake/expand-aliases.xsl", "/org/eolang/parser/shake/resolve-aliases.xsl", "/org/eolang/parser/shake/add-default-package.xsl", diff --git a/eo-parser/src/main/resources/org/eolang/parser/parse/stars-to-tuples.xsl b/eo-parser/src/main/resources/org/eolang/parser/parse/stars-to-tuples.xsl index ce67d12b3d..ec8066fed4 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/parse/stars-to-tuples.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/parse/stars-to-tuples.xsl @@ -49,68 +49,29 @@ SOFTWARE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl b/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl index 714ad0e981..1f093a13da 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/phi/to-phi.xsl @@ -160,7 +160,7 @@ SOFTWARE. - + @@ -246,7 +246,7 @@ SOFTWARE. CHECKS IF APPLICATION ARGUMENTS IS RIGHT ORDER WITH ALPHAS, e.g. α0 -> a, α1 -> b, ..., αN -> z --> - + @@ -400,13 +400,6 @@ SOFTWARE. - - - - - - - @@ -473,7 +466,7 @@ SOFTWARE. - + diff --git a/eo-parser/src/main/resources/org/eolang/parser/phi/to-salty-phi.xsl b/eo-parser/src/main/resources/org/eolang/parser/phi/to-salty-phi.xsl index c19af543b4..c83f4a634e 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/phi/to-salty-phi.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/phi/to-salty-phi.xsl @@ -252,13 +252,6 @@ SOFTWARE. - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/print/dataized-to-const.xsl b/eo-parser/src/main/resources/org/eolang/parser/print/dataized-to-const.xsl index 74d318c1d8..cda7ea4cf9 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/print/dataized-to-const.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/print/dataized-to-const.xsl @@ -33,11 +33,7 @@ SOFTWARE. - - - - - + diff --git a/eo-parser/src/main/resources/org/eolang/parser/print/tuples-to-stars.xsl b/eo-parser/src/main/resources/org/eolang/parser/print/tuples-to-stars.xsl index 7f834b1a93..23179e02c4 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/print/tuples-to-stars.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/print/tuples-to-stars.xsl @@ -27,32 +27,20 @@ SOFTWARE. Performs the reverse operation of "/org/eolang/parser/stars-to-tuples.xsl" --> - + - - - - - + - + - - - - - - - - - - - + + + diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/abstracts-float-up.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/abstracts-float-up.xsl deleted file mode 100644 index e3cf7b7a9c..0000000000 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/abstracts-float-up.xsl +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - a - - - - - - - t - - - - - $ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - . - - . - - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/add-default-package.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/add-default-package.xsl index 29f179063c..fbd62b2697 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/add-default-package.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/add-default-package.xsl @@ -24,7 +24,11 @@ SOFTWARE. --> @@ -39,10 +45,7 @@ SOFTWARE. - - - - + diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl deleted file mode 100644 index 4a47ff74bb..0000000000 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/add-refs.xsl +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - bytes - string - number - - - - - - - - - - - - - - - - - - Duplicate names inside " - - ", the base is " - - " at the line # - - pointing to - - - , - - < - - /> - at line # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl new file mode 100644 index 0000000000..980e15da26 --- /dev/null +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/build-fqns.xsl @@ -0,0 +1,245 @@ + + + + + + + + bytes + string + number + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/explicit-data.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/explicit-data.xsl index 966665c346..6dfbed9d44 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/explicit-data.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/explicit-data.xsl @@ -92,9 +92,6 @@ SOFTWARE. - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/fix-missed-names.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/fix-missed-names.xsl deleted file mode 100644 index acd17a480e..0000000000 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/fix-missed-names.xsl +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/remove-refs.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/remove-refs.xsl deleted file mode 100644 index f67b6b7b18..0000000000 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/remove-refs.xsl +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/resolve-aliases.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/resolve-aliases.xsl index 391cb872d1..a7444ae51b 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/resolve-aliases.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/resolve-aliases.xsl @@ -24,19 +24,17 @@ SOFTWARE. --> - - - - + diff --git a/eo-parser/src/main/resources/org/eolang/parser/shake/vars-float-up.xsl b/eo-parser/src/main/resources/org/eolang/parser/shake/vars-float-up.xsl index 6e2a596f3b..b863a28cb6 100644 --- a/eo-parser/src/main/resources/org/eolang/parser/shake/vars-float-up.xsl +++ b/eo-parser/src/main/resources/org/eolang/parser/shake/vars-float-up.xsl @@ -72,12 +72,6 @@ SOFTWARE. - - - - - - diff --git a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java index 7d082ca64e..2743ec5143 100644 --- a/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java +++ b/eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java @@ -45,6 +45,7 @@ import org.hamcrest.Matchers; 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.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -81,6 +82,23 @@ void parsesSimpleCode() throws Exception { ); } + @Test + @Disabled + void prohibitsMoreThanOneTailingEol() throws Exception { + MatcherAssert.assertThat( + "doesn't prohibit more than one tailing EOL", + XhtmlMatchers.xhtml( + new String( + new EoSyntax( + new InputOf("# No comments.\n[] > foo\n\n\n\n") + ).parsed().toString().getBytes(StandardCharsets.UTF_8), + StandardCharsets.UTF_8 + ) + ), + XhtmlMatchers.hasXPaths("/program/errors/error") + ); + } + @Test void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { final String src = String.join( @@ -89,7 +107,7 @@ void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { "[] > x-н, 1\n" ); MatcherAssert.assertThat( - EoIndentLexerTest.TO_ADD_MESSAGE, + "EO syntax is broken, but listing should be printed", XhtmlMatchers.xhtml( new String( new EoSyntax( @@ -100,7 +118,7 @@ void printsProperListingEvenWhenSyntaxIsBroken() throws Exception { ) ), XhtmlMatchers.hasXPaths( - "/program/errors[count(error)=2]", + "/program/errors[count(error)=3]", String.format("/program[listing='%s']", src) ) ); @@ -279,10 +297,10 @@ void checksTypoPacks(final String yaml) { if (story.map().containsKey(msg)) { MatcherAssert.assertThat( XhtmlMatchers.xhtml(story.after()).toString(), - story.after() - .xpath("/program/errors/error[1]/text()") - .get(0) - .replaceAll("\r", ""), + String.join( + "\n", + story.after().xpath("/program/errors/error/text()") + ).replaceAll("\r", ""), Matchers.equalTo(story.map().get(msg).toString()) ); } diff --git a/eo-parser/src/test/java/org/eolang/parser/XslBenchmarkIT.java b/eo-parser/src/test/java/org/eolang/parser/XslBenchmarkIT.java index 1460c03a3d..fee7414a6b 100644 --- a/eo-parser/src/test/java/org/eolang/parser/XslBenchmarkIT.java +++ b/eo-parser/src/test/java/org/eolang/parser/XslBenchmarkIT.java @@ -65,9 +65,9 @@ public class XslBenchmarkIT { * Pairs of XSL and worst XMIR for the XSL. */ @Param({ - "/org/eolang/parser/add-default-package.xsl|org/eolang/parser/benchmark/native.xmir", - "/org/eolang/parser/add-refs.xsl|org/eolang/parser/benchmark/native.xmir", - "/org/eolang/parser/explicit-data.xsl|org/eolang/parser/benchmark/native.xmir" + "/org/eolang/parser/shake/add-default-package.xsl|org/eolang/parser/benchmark/native.xmir", + "/org/eolang/parser/shake/build-fqns.xsl|org/eolang/parser/benchmark/native.xmir", + "/org/eolang/parser/shake/explicit-data.xsl|org/eolang/parser/benchmark/native.xmir" }) private String pairs; diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/before-star.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/before-star.yaml index 11c26aac40..e115714169 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/before-star.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/before-star.yaml @@ -23,10 +23,10 @@ sheets: [ ] asserts: - /program/errors/error[@line='3' and @severity='error'] - - /program/objects//o[@name='first' and count(o)=1]/o[@base='tuple' and count(o)=2] - - /program/objects//o[@name='second' and count(o)=2]/o[position()=2 and @base='tuple' and count(o)=2] - - /program/objects//o[@name='third' and count(o)=3]/o[position()=3 and @base='tuple' and count(o)=2] - - /program/objects//o[@name='fourth' and count(o)=2]/o[@base='sprintf' and count(o)=1]/o[@base='tuple' and count(o)=2] + - /program/objects//o[@name='first' and count(o)=1]/o[@base='.with' and count(o)=2] + - /program/objects//o[@name='second' and count(o)=2]/o[position()=2 and @base='.with' and count(o)=2] + - /program/objects//o[@name='third' and count(o)=3]/o[position()=3 and @base='.with' and count(o)=2] + - /program/objects//o[@name='fourth' and count(o)=2]/o[@base='sprintf' and count(o)=1]/o[@base='.with' and count(o)=2] - /program/objects[count(//o[@before-star])=0] input: | # No comments. diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/tuples.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/tuples.yaml index 6826737aad..e447635235 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/tuples.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/parse/tuples.yaml @@ -24,14 +24,25 @@ sheets: [ ] asserts: - //objects[count(o)=7] - //objects[count(//o[@star])=0] - - //o[@base='.empty' and @line=1 and @name='xs']/o[@base='tuple' and @line=1 and not(@name)] - - //o[@base='tuple' and @line=2 and @name='xl']/o[@base='.empty']/o[@base='tuple'] - - //o[@base='tuple' and @line=2 and @name='xl']/o[@base='number'] - - //o[@base='tuple' and @line=3]/o[@base='number'] - - //o[@base='tuple' and @line=3]/o[@base='tuple']/o[@base='.empty']/o[@base='tuple'] - - //o[@base='tuple' and @line=3]/o[@base='tuple']/o[@base='number'] - - //o[@base='.empty' and @line=4]/o[@base='tuple'] + # first + - //o[@base='.empty' and @line=1 and @name='xs']/o[@base='tuple' and not(@name)] + # second + - //o[@base='.with' and @line=2 and @name='xl']/o[@base='.empty']/o[@base='tuple'] + - //o[@base='.with' and @line=2 and @name='xl']/o[@base='number'] + # third + - //o[@base='.with' and @line=3 and not(@name)]/o[@base='.with']/o[@base='.empty']/o[@base='tuple'] + - //o[@base='.with' and @line=3 and not(@name)]/o[@base='.with']/o[@base='number'] + - //o[@base='.with' and @line=3 and not(@name)]/o[@base='number'] + # fourth + - //o[@base='.empty' and @line=4]/o[@base='.empty']/o[@base='tuple'] + # fifth + - //o[@base='.with' and @line=5 and not(@name)]/o[@base='.with']/o[@base='.with']/o[@base='.empty']/o[@base='tuple'] + - //o[@base='.with' and @line=5 and not(@name)]/o[@base='.with']/o[@base='.with']/o[@base='.c'] + - //o[@base='.with' and @line=5 and not(@name)]/o[@base='.with']/o[@base='.f'] + - //o[@base='.with' and @line=5 and not(@name)]/o[@base='.i'] + # sixth - //o[@base='.elements']/o[@base='arr']/o[@base='.empty']/o[@base='tuple'] + # seventh - //o[@base='.reduced']/o[@base='list'] - //o[@base='.reduced']/o[@base='.empty']/o[@base='tuple'] - //o[@base='.reduced']/o[not(@base)]/o[@base='∅' and @name='x'] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/dataized-to-const.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/dataized-to-const.yaml index 1835eeaf53..94dd7e3984 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/dataized-to-const.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/dataized-to-const.yaml @@ -21,9 +21,9 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/expand-qqs.xsl - - /org/eolang/parser/shake/add-refs.xsl - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl + - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/parser/shake/explicit-data.xsl - /org/eolang/parser/print/dataized-to-const.xsl @@ -32,7 +32,7 @@ asserts: - //o[@base='.as-bytes' and @name='second']/o[@base='org.eolang.dataized'] - //o[@base='org.eolang.a' and @const and @name='third']/o[@base='org.eolang.b'] - //o[@name='fourth-1' and not(@base)] - - //o[@base='fourth-1' and @name='fourth' and @const] + - //o[@base='.fourth-1' and @name='fourth' and @const] - //o[@base='org.eolang.number' and @name='fifths' and @const]/o[@base='org.eolang.bytes' and text()!=''] - //o[@base='org.eolang.bytes' and @name='sixth' and @const and text()='2A-'] input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/tuples-to-stars.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/tuples-to-stars.yaml index e5a3e36057..b9510c9b21 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/tuples-to-stars.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/print/tuples-to-stars.yaml @@ -33,9 +33,9 @@ input: | # No comments. [] > foo - tuple - tuple - tuple + with. + with. + with. tuple.empty 1 2 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-locators.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-locators.yaml index 1d7fd7462f..fa665f974a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-locators.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-locators.yaml @@ -12,7 +12,7 @@ # 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 +# 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 @@ -22,16 +22,16 @@ --- sheets: - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/parser/shake/explicit-data.xsl - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/parser/shake/blank-xsd-schema.xsl asserts: - /program[not(errors)] - //o[@name='a' and @loc='Φ.org.abc.a'] @@ -39,12 +39,12 @@ asserts: - //o[@base='org.eolang.string' and @loc='Φ.org.abc.a.φ.α0.α0'] - //o[@base='x' and @name='tt' and @loc='Φ.org.abc.tt'] - //o[@base='org.eolang.number' and @loc='Φ.org.abc.tt.α0'] - - //o[@base='org.eolang.tuple' and @loc='Φ.org.abc.tt.α1'] - - //o[@base='org.eolang.number' and @loc='Φ.org.abc.tt.α1.α1'] + - //o[@base='org.eolang.tuple' and @loc='Φ.org.abc.tt.α1.ρ.ρ.ρ'] + - //o[@base='org.eolang.number' and @loc='Φ.org.abc.tt.α1.ρ.α0'] - //o[not(@base) and @loc='Φ.org.abc.tt.α2'] - //o[@base='∅' and @name='e' and @loc='Φ.org.abc.tt.α2.e'] - //o[@base='.hello' and @loc='Φ.org.abc.tt.α2.φ'] - - //o[@base='e' and @loc='Φ.org.abc.tt.α2.φ.ρ'] + - //o[@base='.e' and @loc='Φ.org.abc.tt.α2.φ.ρ'] - //o[@name='q' and @base='.p' and @loc='Φ.org.abc.q'] - //o[@base='.^' and not(@name) and @loc='Φ.org.abc.q.ρ'] - //o[@base='.^' and not(@name) and @loc='Φ.org.abc.q.ρ.ρ'] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes-to-empty.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes-to-empty.yaml index fa0a63fee7..4db42ea227 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes-to-empty.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes-to-empty.yaml @@ -22,16 +22,16 @@ --- sheets: - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/parser/shake/explicit-data.xsl - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/parser/shake/blank-xsd-schema.xsl asserts: - /program[not(errors)] - //metas[count(.//meta[head/text()='probe'])=1] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes.yaml index c1e6ba9a4d..6863dfb6e4 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/add-probes.yaml @@ -22,16 +22,16 @@ --- sheets: - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/parser/shake/explicit-data.xsl - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/parser/shake/blank-xsd-schema.xsl asserts: - /program[not(errors)] - /program/sheets/sheet[contains(text(),'add-probes')] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-default-package.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-default-package.yaml index f53382c7ac..a9ea958788 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-default-package.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-default-package.yaml @@ -21,7 +21,11 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/cti-adds-errors.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl + - /org/eolang/parser/shake/expand-qqs.xsl + - /org/eolang/parser/shake/add-probes.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl - /org/eolang/parser/shake/add-default-package.xsl diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-no-probes.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-no-probes.yaml index 8f8c48f154..0554844449 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-no-probes.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-no-probes.yaml @@ -22,16 +22,16 @@ --- sheets: - /org/eolang/parser/shake/cti-adds-errors.xsl - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/add-probes.xsl - - /org/eolang/parser/shake/vars-float-up.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl - /org/eolang/parser/shake/add-default-package.xsl - /org/eolang/parser/shake/explicit-data.xsl - /org/eolang/parser/shake/set-locators.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/parser/shake/blank-xsd-schema.xsl asserts: - /program[not(errors)] - /program[not(metas)] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-refs.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-refs.yaml deleted file mode 100644 index b36c2d0cda..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/adds-refs.yaml +++ /dev/null @@ -1,61 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/add-refs.xsl -asserts: - - /program[not(errors)] - - /program/objects[count(o)=3] - - //objects[not(//o[@ref and @base='@'])] - - //o[@base='x' and @ref='2'] - - //o[@base='x' and @line='8' and @ref='5'] - - //o[@base='x' and @line='12' and @ref='5'] - - //o[@base='a' and @line='10' and @ref='13'] - - //o[@base='something' and @line='13' and @name='a' and not(@ref)] - - //o[@base='x' and @line='18' and @ref='16'] - - //o[@base='first' and @line='19' and @ref='2'] -input: | - # No comments. - [x a] > first - stdout x - second > hello - third > x - stdout "Hi" - one - x - two - a > @ - three - x - something > a - - # No comments. - [a] > x - tt - x 4 - first - - # No comments. - [] > y - one - [f] - 1 > ooo diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/as-type-optimization.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/as-type-optimization.yaml deleted file mode 100644 index 313d6aa652..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/as-type-optimization.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/add-default-package.xsl - - /org/eolang/parser/shake/constant-folding.xsl - - /org/eolang/parser/shake/blank-xsd-schema.xsl -asserts: - - /program[not(errors)] - - //o[@base='org.eolang.bool' and o[@base='org.eolang.bytes' and text()='01-']] - - //o[@base='org.eolang.bool' and o[@base='org.eolang.bytes' and text()='00-']] -input: | - 01-.as-bool - 00-.as-bool diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml new file mode 100644 index 0000000000..9622d29cda --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/build-fqn.yaml @@ -0,0 +1,64 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2025 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. +--- +sheets: + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl +asserts: + - /program[not(errors)] + - /program/objects[count(o)=3] + - /program/objects/o[@base='.foo' and @name='bar']/o[@base='.examples']/o[@base='.org']/o[@base='Q'] + - /program/objects/o[@name='foo'] + - /program/objects/o[@name='first']/o[@base='stdout' and @name='std']/o[@base='.x']/o[@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@base='.std']/o[1][@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@base='.std']/o[2][@base='.x']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='number' and @name='x' and text()!=''] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.plus']/o[1][@base='.x']/o[1][@base='$'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.plus']/o[2][@base='.y']/o[1][@base='.^']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.std']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.std']/o[2][@base='qwe'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.third']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='third']/o[@base='.third']/o[2][@base='.bar']/o[@base='.examples']/o[@base='.org']/o[@base='Q'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='string' and @name='inner'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='.inner' and @name='outer']/o[1][@base='^'] + - /program/objects/o[@name='first']/o[@name='second']/o[@name='fourth']/o[@base='.inner' and @name='self']/o[1][@base='$'] +input: |- + +package org.examples + + # No comments. + [x y] > first + stdout x > std + [std] > second + std x > inner + [] > third + 5 > x + x.plus y > sum + third bar > baz + std qwe > closest + [] > fourth + "some" > inner + ^.inner > outer + inner > self + foo > bar + + # Foo. + [] > foo diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/explicit-data.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/explicit-data.yaml index f8d545bbbc..c82b7a8bdf 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/explicit-data.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/explicit-data.yaml @@ -32,7 +32,7 @@ asserts: - //o[@base='org.eolang.bytes' and @name='fourth' and not(o) and text()='11-21'] - //o[@base='.string' and @name='str' and count(o)=2 and o[last() and @base='org.eolang.bytes' and text()='48-65-79']] - //o[@base='org.eolang.bytes' and @name='bt' and count(o)=0 and text()='A2-'] - - //o[@base='org.eolang.tuple' and o[@base='org.eolang.tuple' and o[@base='org.eolang.number' and o[@base='org.eolang.bytes' and text()='3F-F0-00-00-00-00-00-00']]]] + - //o[@base='.with']/o[@base='.with']/o[@base='.with']/o[@base='org.eolang.number']/o[@base='org.eolang.bytes' and text()='3F-F0-00-00-00-00-00-00'] input: | 42 > first number 11-21 > bts @@ -41,6 +41,6 @@ input: | 11-21 Q.org.eolang.string "Hey" > str Q.org.eolang.bytes A2- > bt - tuple + * * 1 2 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/fix-names-with-duplicates.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/fix-names-with-duplicates.yaml deleted file mode 100644 index cbe437f476..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/fix-names-with-duplicates.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl -asserts: - - //objects[count(.//o[@base='hello$t1$t2$t2$t1$a0$build'] and @name='next')=1] - - //objects[count(.//o[@base='hello$t1$t2$t2$t1$a1$build'] and @name='next')=1] -input: | - # No comments - [] > hello - # No comments - [f s] > calc - plus. > @ - f.next - s.next - - seq > @ - QQ.io.stdout - QQ.txt.sprintf - "Result is %d\n" - calc - [] - # No comments - [x] > build - x.plus 1 > @ - build (@.plus 1) > next - build 1 > @ - [] - # No comments - [y] > build - y.plus 2 > @ - build (@.plus 2) > next - build 2 > @ - true diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-abstracts.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-abstracts.yaml deleted file mode 100644 index 7456b56626..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-abstracts.yaml +++ /dev/null @@ -1,70 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program/objects[count(o)=9] - - /program[not(errors)] - - //objects[not(.//o[@name=''])] - - //o[@name='first$t2$native'] - - //o[@base='first$t2$native'] - - //o[@name='first' and not(@ancestors)] - - //o[@name='first']/o[@base='test'] - - //o[@name='first$t2$second'] - - //o[@name='first$t2$second$third']/o[@base='.print']/o[@base='stdout']/o[@base='a'] - - //o[@line and @name='aa'] -input: | - # No comments. - [a b] > first - test > foo - a > yes - # No comments. - [] > native - # No comments. - [x b] > second - a > no - # No comments. - [b c] > third - no > yes - (stdout a b c x).print > print - t - # No comments. - [] > third - "hello, world!" > msg - f - # No comments. - [] > third - "hello, world!" > msg - # No comments. - [] > fourth - "Failure" > failure - - # No comments. - [aa] > ooo - # No comments. - [bbb] > fff - aa.test > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-and-keep-names.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-and-keep-names.yaml deleted file mode 100644 index f4e44607cc..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-and-keep-names.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - //o[@base='first$second' and @line='6'] -input: | - # No comments - [a] > first - # No comments - [b] > second - print - second 1 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom-vars.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom-vars.yaml index f24102876a..ea1478ef93 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom-vars.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom-vars.yaml @@ -21,7 +21,7 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/cti-adds-errors.xsl - /org/eolang/parser/shake/vars-float-up.xsl asserts: - /program/objects[not(o[@atom and @base])] diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom.yaml deleted file mode 100644 index 65d9bfb580..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-atom.yaml +++ /dev/null @@ -1,37 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/fix-missed-names.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - //objects[not(//o[@atom and @base])] - - //objects[not(//o[@atom and o[@base!='∅']])] - - //o[@atom and o[@base='∅']] -input: | - # No comments. - [] > main - [x] > foo /number diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-up-same-attrs.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-up-same-attrs.yaml deleted file mode 100644 index 6e6860e0fa..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-up-same-attrs.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/remove-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[count(.//o[@base='build' and not(@ref)])=2] -input: | - # No comments. - [] > hello - # No comments. - [f s] > calc - plus. > @ - f.next - s.next - seq > @ - QQ.io.stdout - QQ.txt.sprintf - "Result is %d\n" - calc - [] - # No comments. - [x] > build - x.plus 1 > @ - build (@.plus 1) > next - build 1 > @ - [] - # No comments. - [y] > build - y.plus 2 > @ - build (@.plus 2) > next - build 2 > @ - true diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-vars.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-vars.yaml index 53a38e00ef..d45ef7adb6 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-vars.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/float-vars.yaml @@ -21,7 +21,7 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/cti-adds-errors.xsl - /org/eolang/parser/shake/vars-float-up.xsl asserts: - /program[not(errors)] @@ -30,11 +30,10 @@ asserts: - //objects[count(.//o[@base='string'])=1] - //o[@name='y']/o[@name='t'] - //o[@name='y']/o[@name='oops'] - - //o[@name='last' and not(@cut)] + - //o[@name='last'] - //objects[count(//o[@name='oops'])=1] - - //objects[count(//o[@cut='0'])=1] - - //o[@name='aaa' and not(@cut)] - - //o[@name='ooo' and not(@cut)] + - //o[@name='aaa'] + - //o[@name='ooo'] - //o[@name='mm' and @base='number'] - //o[@base='mm'] input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/not-redundant-levels.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/not-redundant-levels.yaml deleted file mode 100644 index 5af17e0c38..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/not-redundant-levels.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'first' object - - //o[@name='first'] - - //o[@name='first']/o[@base='first$second' and @name='second'] - - //o[@name='first']/o[@base='first$second' and @name='second']/o[@base='arg'] - # 'first$second' object - - //o[@name='first$second'] - - //o[@name='first$second']/o[@name='arg'] - - //o[@name='first$second']/o[@base='.method' and @name='a'] -# Converts the code from the snippet to the next: -# ____ -# -# [arg] > first -# first$second > second -# arg -# -# [arg] > first$second -# arg.method > a -# ____ -input: | - # No comments. - [arg] > first - # No comments. - [] > second - arg.method > a diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/recursion.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/recursion.yaml index 150edc851b..c62c7fa897 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/recursion.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/recursion.yaml @@ -21,11 +21,13 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/cti-adds-errors.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl asserts: - /program[not(errors)] - //o[@name='f' and @line='8'] - - //o[@base='f' and @ref='8'] + - //o[@base='.f']/o[@base='^'] input: | +home https://github.com/objectionary/eo +package test diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-abstract-parents.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-abstract-parents.yaml deleted file mode 100644 index ac819f0e58..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-abstract-parents.yaml +++ /dev/null @@ -1,80 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'main' object - - //o[@name='main'] - - //o[@name='main']/o[@base='sibling' and @name='@'] - - //o[@name='main']/o[@base='∅' and @name='arg'] - - //o[@name='main']/o[@base='main$sibling' and @name='sibling'] - - //o[@name='main']/o[@base='main$sibling' and @name='sibling']/o[@base='arg' and not(@name)] - # 'main$sibling' object - - //o[@name='main$sibling' and count(o)=3] - - //o[@name='main$sibling']/o[@base='∅' and @name='arg'] - - //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first'] - - //o[@name='main$sibling']/o[@base='main$sibling$first' and @name='first']/o[@base='arg' and not(@name)] - - //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second'] - - //o[@name='main$sibling']/o[@base='main$sibling$second' and @name='second']/o[@base='arg' and not(@name)] - # 'main$sibling$first' object - - //o[@name='main$sibling$first' and count(o)=2] - - //o[@name='main$sibling$first']/o[@base='.one' and @name='@']/o[@base='arg' and not(@name)] - - //o[@name='main$sibling$first']/o[@base='∅' and @name='arg'] - # 'main$sibling$second' object - - //o[@name='main$sibling$second' and count(o)=2] - - //o[@name='main$sibling$second']/o[@base='.two' and @name='@']/o[@base='arg' and not(@name)] - - //o[@name='main$sibling$second']/o[@base='∅' and @name='arg'] -# Currently the test converts the code from the snippet to: -# ____ -# [arg] > main -# sibling > @ -# main$sibling > sibling -# arg -# -# [arg] > main$sibling -# main$sibling$first > first -# arg -# main$sibling$second > second -# arg -# -# [arg] > main$sibling$first -# arg.one > @ -# -# [] > main$sibling$second -# arg.two > @ -# ____ -input: | - # No comments. - [arg] > main - sibling > @ - # No comments. - [] > sibling - # No comments. - [] > first - arg.one > @ - # No comments. - [] > second - arg.two > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-siblings.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-siblings.yaml deleted file mode 100644 index d5ae1d25a6..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arguments-and-siblings.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'main' object - - //o[@name='main'] - - //o[@name='main']/o[@base='sibling' and @name='@'] - - //o[@name='main']/o[@base='.eq' and @name='sibling'] - - //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$first' and @name='first' and count(o)=1] - - //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t2$second' and @name='second' and count(o)=1] - # 'main$t2$first' object - - //o[@name='main$t2$first' and count(o)=2] - - //o[@name='main$t2$first']/o[@base='.one' and @name='@']/o[@base='arg' and not(@name)] - - //o[@name='main$t2$first']/o[@base='∅' and @name='arg'] - # 'main$t2$second' object - - //o[@name='main$t2$second' and count(o)=2] - - //o[@name='main$t2$second']/o[@base='.two' and @name='@']/o[@base='arg' and not(@name)] - - //o[@name='main$t2$second']/o[@base='∅' and @name='arg'] -# Currently the test converts the code from the snippet to: -# ____ -# [arg] > main -# sibling > @ -# eq. > sibling -# main$t2$first > first -# arg -# main$t2$second > second -# arg -# -# [arg] > main$t2$first -# arg.one > @ -# -# [] > main$t2$second -# arg.two > @ -# ____ -input: | - # No comments. - [arg] > main - sibling > @ - eq. > sibling - # No comments. - [] > first - arg.one > @ - # No comments. - [] > second - arg.two > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arrays.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arrays.yaml deleted file mode 100644 index fc946c6974..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-arrays.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'main' object - - //o[@name='main'] - - //o[@name='main' and count(o)=2] - - //o[@name='main']/o[@base='tuple' and @name='arr' and count(o)=2] - - //o[@name='main']/o[@base='eq' and @name='@' and count(o)=2] - # The first tuple - argument of arr from the example below - - //o[@base='tuple' and count(o)=2] - # The second tuple - first argument of eq from the example below - - //o[@base='eq']/o[@base='tuple']/o[@base='.empty']/o[@base='tuple'] - - //o[@base='eq']/o[@base='tuple']/o[@base='.at']/o[@base='.at']/o[@base='arr'] - - //o[@base='eq']/o[@base='tuple']/o[@base='.at']/o[@base='.at']/o[@base='number'] - - //o[@base='eq']/o[@base='tuple']/o[@base='.at']/o[@base='number'] -# Currently the test converts the code from the snippet to: -# ____ -# [] > main -# tuple > arr -# 0 -# tuple -# 1 -# 2 -# eq > @ -# tuple -# .at -# .at -# arr -# 1 -# 1 -# tuple -# 2 -# ____ -input: | - # No comments. - [] > main - * 0 (* 1 2) > arr - eq > @ - * ((arr.at 1).at 1) - * 2 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-siblings.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-siblings.yaml deleted file mode 100644 index 1adbb6c40f..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels-with-siblings.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'main' object - - //o[@name='main'] - - //o[@name='main']/o[@base='sibling' and @name='@'] - - //o[@name='main']/o[@base='.eq' and @name='sibling'] - - //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t1$first' and @name='first' and count(o)=0] - - //o[@name='main']/o[@base='.eq' and @name='sibling']/o[@base='main$t1$second' and @name='second' and count(o)=0] - # 'main$t1$first' object - - //o[@name='main$t1$first' and count(o)=1] - - //o[@name='main$t1$first']/o[@base='number' and @name='@'] - # 'main$t1$second' object - - //o[@name='main$t1$second' and count(o)=1] - - //o[@name='main$t1$second']/o[@base='number' and @name='@'] -# Currently the test converts the code from the snippet to: -# ____ -# [] > main -# sibling > @ -# eq. > sibling -# main$t1$first > first -# main$t1$second > second -# -# [] > main$t1$first -# 1 > @ -# -# [] > main$t1$second -# 2 > @ -# ____ -input: | - # No comments. - [] > main - sibling > @ - eq. > sibling - # No comments. - [] > first - 1 > @ - # No comments. - [] > second - 2 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels.yaml deleted file mode 100644 index 0b500e57d9..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/redundant-levels.yaml +++ /dev/null @@ -1,63 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -sheets: - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/remove-levels.xsl - - /org/eolang/parser/shake/clean-up.xsl -asserts: - - /program[not(errors)] - # 'another' object - - //o[@name='another'] - - //o[@name='another']/o[@base='.eq' and @name='@'] - - //o[@name='another']/o[@base='.eq' and @name='@']/o[@base='another$t0$first' and @name='first'] - - //o[@name='another']/o[@base='.eq' and @name='@']/o[@base='another$t0$second' and @name='second'] - # 'another$t0$first' object - - //o[@name='another$t0$first' and count(o)=1] - - //o[@name='another$t0$first']/o[@base='number' and @name='@'] - # 'another$t0$second' object - - //o[@name='another$t0$second' and count(o)=1] - - //o[@name='another$t0$second']/o[@base='number' and @name='@'] -# Currently the test converts the code from the snippet to: -# ____ -# [] > another -# eq. > @ -# another$t0$first > first -# another$t0$second > second -# -# [] > another$t0$first -# 1 > @ -# -# [] > another$t0$second -# 2 > @ -# ____ - -input: | - # No comments. - [] > another - eq. > @ - # No comments. - [] > first - 1 > @ - # No comments. - [] > second - 2 > @ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/resolves-aliases.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/resolves-aliases.yaml index 5f8a95687f..9dbbf10d50 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/resolves-aliases.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/resolves-aliases.yaml @@ -21,7 +21,10 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl + - /org/eolang/parser/shake/cti-adds-errors.xsl + - /org/eolang/parser/shake/vars-float-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl + - /org/eolang/parser/shake/expand-qqs.xsl - /org/eolang/parser/shake/expand-aliases.xsl - /org/eolang/parser/shake/resolve-aliases.xsl asserts: diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/floating-sets-parent-names.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml similarity index 70% rename from eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/floating-sets-parent-names.yaml rename to eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml index ab76c6b34f..2cf85919ca 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/floating-sets-parent-names.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-packs/shake/skips-fqns-in-primitives.yaml @@ -21,18 +21,24 @@ # SOFTWARE. --- sheets: - - /org/eolang/parser/shake/add-refs.xsl - - /org/eolang/parser/shake/abstracts-float-up.xsl - - /org/eolang/parser/shake/clean-up.xsl + - /org/eolang/parser/shake/build-fqns.xsl asserts: - /program[not(errors)] - - //o[@name='a$m$t2$a0'] -input: | + - /program/objects[count(o)=3] + - /program/objects/o[@name='number']/o[@base='number' and @name='self' and text()!=''] + - /program/objects/o[@name='bytes']/o[@base='bytes' and @name='self' and text()!=''] + - /program/objects/o[@name='string']/o[@base='string' and @name='self' and text()!=''] +input: |- + +package org.eolang + # No comments. - [] > a - # No comments. - [f] > m - $ > this - z > @ - [i] - 42 > @ + [] > number + 5 > self + + # No comment. + [] > bytes + 2A- > self + + # No comment. + [] > string + "Hello" > self diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/binding-with-rho.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/binding-with-rho.yaml index 061fe04ce3..970c35027c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/binding-with-rho.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/binding-with-rho.yaml @@ -21,10 +21,12 @@ # SOFTWARE. --- line: 2 -message: >- - [2:4] error: 'Invalid object declaration' +message: |+ + [2:4] error: 'Invalid objects declaration that may be used inside abstract object' y:^ ^ -input: | + [3:-1] error: 'We expected the program to end here but encountered something unexpected' + +input: |- x y:^ diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/broken-head.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/broken-head.yaml index a5a3a8c1d1..3807b745fc 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/broken-head.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/broken-head.yaml @@ -22,7 +22,10 @@ --- line: 2 message: |- - [2:7] error: 'Invalid object declaration' + [2:0] error: 'Atom must have a type' + [] > a [] > b [] > c [] > d hello world + ^^^^^^^ + [2:7] error: 'mismatched input '[' expecting '/'' [] > a [] > b [] > c [] > d hello world ^ input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/comment-in-method.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/comment-in-method.yaml index df49acf048..a62a2a7915 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/comment-in-method.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/comment-in-method.yaml @@ -21,12 +21,17 @@ # SOFTWARE. --- line: 5 -# @todo #3706:30min The error message doesn't highlight the exact position of the -# comment. The error message should be updated to point to the exact position -# of the comment. -message: | +message: |- [5:12] error: 'Invalid object declaration' sprintwf + + [5:12] error: 'Invalid objects declaration that may be used inside abstract object' + sprintwf + + [4:-1] error: 'We expected the program to end here but encountered something unexpected' + # a comment here is prohibited + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + input: | # No comments [args] > app diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/double-empty-lines.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/double-empty-lines.yaml index c688e9ab33..8c08b92ffb 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/double-empty-lines.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/double-empty-lines.yaml @@ -25,8 +25,8 @@ line: 4 # Cryptic error message is returned when there are two empty lines between metas. # The error message should be more informative and should highlight the exact location # of the error. -message: | - [4:0] error: 'extraneous input '\n' expecting {COMMENTARY, 'Q', 'QQ', '*', '$', '[', '(', '@', '^', BYTES, STRING, INT, FLOAT, HEX, NAME, TEXT}' +message: |+ + [4:0] error: 'We expected the program to end here but encountered something unexpected' input: | # No comments. diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/empty-line-between-metas.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/empty-line-between-metas.yaml index 5bc1f8ac67..8f070f55c6 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/empty-line-between-metas.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/empty-line-between-metas.yaml @@ -22,7 +22,7 @@ --- line: 3 message: |- - [3:0] error: 'Invalid object declaration' + [3:0] error: 'We expected a list of objects here but encountered something unexpected' +meta other ^^^^^^^^^^ input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/not-empty-atoms.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/not-empty-atoms.yaml index c7d006ccbd..2affbda7a9 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/not-empty-atoms.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/not-empty-atoms.yaml @@ -22,7 +22,7 @@ --- line: 4 message: |- - [4:-1] error: 'Invalid program declaration' + [4:-1] error: 'We expected the program to end here but encountered something unexpected' [] > inner ^^^^^^^^^^^^ input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application-named.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application-named.yaml index 16632d4cbb..f18ed6dd5d 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application-named.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application-named.yaml @@ -21,10 +21,9 @@ # SOFTWARE. --- line: 3 -message: |- - [3:-1] error: 'Invalid program declaration' - EOF - ^^^ +message: |+ + [3:-1] error: 'We expected the program to end here but encountered something unexpected' + input: | 1.add 1 > x (1.add 1) > y diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application.yaml index df20ec1a2d..f07a3f6a26 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/redundant-parentheses/simple-application.yaml @@ -26,10 +26,9 @@ line: 3 # The error message should be more informative and should point to the exact # place in the input where the error occurred. Moreover it should be clear # what to do to fix the error. 'simple-application-named.yaml' has the same issue. -message: |- - [3:-1] error: 'Invalid program declaration' - EOF - ^^^ +message: |+ + [3:-1] error: 'We expected the program to end here but encountered something unexpected' + input: | 1.add 1 > x (1.add 1) diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml deleted file mode 100644 index 01e5d1e1bb..0000000000 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2025 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. ---- -line: 4 -# yamllint disable rule:trailing-spaces -input: | - # No comments. - [] > t - # No comments - # This one with space at the end - [] > x diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/two-spaces.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/two-spaces.yaml index 3348c3f1c4..686b813e0a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/two-spaces.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/two-spaces.yaml @@ -21,10 +21,22 @@ # SOFTWARE. --- line: 5 +# @todo #3744:60min Error Message Duplicates. +# As you can see, we have multiple error messages that are the +# same. We should remove duplicates and keep only meaningful error messages. message: >- [5:2] error: 'Invalid object declaration' * ^ + [5:2] error: 'Invalid object declaration' + * + ^ + [5:2] error: 'Invalid objects declaration that may be used inside abstract object' + * + ^ + [5:-1] error: 'We expected the program to end here but encountered something unexpected' + * + ^^^^ input: | # This is a code snippet from the following issue: # https://github.com/objectionary/eo/issues/3332 diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-happlication.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-happlication.yaml index 810d04e1b4..9c9a6e215a 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-happlication.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-happlication.yaml @@ -22,7 +22,7 @@ --- line: 2 message: |- - [2:0] error: 'Invalid program declaration' + [2:0] error: 'We expected the program to end here but encountered something unexpected' .z ^ input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-hmethod.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-hmethod.yaml index 19014044f9..3e92fe0c4c 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-hmethod.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/vmethod-after-hmethod.yaml @@ -22,7 +22,7 @@ --- line: 2 message: |- - [2:0] error: 'Invalid program declaration' + [2:0] error: 'We expected the program to end here but encountered something unexpected' .z ^ input: | diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/fibonaci.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/fibonaci.yaml index 11cd0fc67c..b1821ec82b 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/fibonaci.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/fibonaci.yaml @@ -41,7 +41,10 @@ sweet: |- example ↦ ⟦ fibonacci(n) ↦ ⟦ φ ↦ ξ.n.lt(2).if( - ξ.n, ξ.ρ.fibonacci(ξ.n.minus(1)).plus(ξ.ρ.fibonacci(ξ.n.minus(2))) + ξ.n, + Φ.eo.example.fibonacci(ξ.n.minus(1)).plus( + Φ.eo.example.fibonacci(ξ.n.minus(2)) + ) ) ⟧, λ ⤍ Package @@ -64,7 +67,7 @@ salty: |- ) ).if( α0 ↦ ξ.n, - α1 ↦ ξ.ρ.fibonacci( + α1 ↦ Φ.eo.example.fibonacci( α0 ↦ ξ.n.minus( α0 ↦ Φ.org.eolang.number( α0 ↦ Φ.org.eolang.bytes( @@ -73,7 +76,7 @@ salty: |- ) ) ).plus( - α0 ↦ ξ.ρ.fibonacci( + α0 ↦ Φ.eo.example.fibonacci( α0 ↦ ξ.n.minus( α0 ↦ Φ.org.eolang.number( α0 ↦ Φ.org.eolang.bytes( diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/jeo-part.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/jeo-part.yaml index 2d6fec3795..03b64f3ded 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/jeo-part.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/jeo-part.yaml @@ -37,7 +37,7 @@ sweet: |- j$A ↦ ⟦ access ↦ 32, supername ↦ "java/lang/Object", - interfaces ↦ Φ̇.tuple(Φ̇.tuple.empty, "org/eolang/benchmark/F") + interfaces ↦ Φ̇.tuple.empty.with("org/eolang/benchmark/F") ⟧, λ ⤍ Package ⟧, @@ -63,9 +63,8 @@ salty: |- α0 ↦ ⟦ Δ ⤍ 6A-61-76-61-2F-6C-61-6E-67-2F-4F-62-6A-65-63-74 ⟧ ) ), - interfaces ↦ Φ.org.eolang.tuple( - α0 ↦ Φ.org.eolang.tuple.empty, - α1 ↦ Φ.org.eolang.string( + interfaces ↦ Φ.org.eolang.tuple.empty.with( + α0 ↦ Φ.org.eolang.string( α0 ↦ Φ.org.eolang.bytes( α0 ↦ ⟦ Δ ⤍ 6F-72-67-2F-65-6F-6C-61-6E-67-2F-62-65-6E-63-68-6D-61-72-6B-2F-46 ⟧ ) diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml new file mode 100644 index 0000000000..ed5fe4afdd --- /dev/null +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested-bindings.yaml @@ -0,0 +1,83 @@ +# The MIT License (MIT) +# +# Copyright (c) 2016-2025 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. +--- +input: | + +package com.example + + class > app + 5:version + method:init + 42:0 + "Hey":1 + 42:body +sweet: |- + {⟦ + com ↦ ⟦ + example ↦ ⟦ + app ↦ Φ̇.class( + version ↦ 5, + init ↦ Φ̇.method( + α0 ↦ 42, + α1 ↦ "Hey", + body ↦ 42 + ) + ), + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ + ⟧} +salty: |- + { + ⟦ + com ↦ ⟦ + example ↦ ⟦ + app ↦ Φ.org.eolang.class( + version ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧ + ) + ), + init ↦ Φ.org.eolang.method( + α0 ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-45-00-00-00-00-00-00 ⟧ + ) + ), + α1 ↦ Φ.org.eolang.string( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 48-65-79 ⟧ + ) + ), + body ↦ Φ.org.eolang.number( + α0 ↦ Φ.org.eolang.bytes( + α0 ↦ ⟦ Δ ⤍ 40-45-00-00-00-00-00-00 ⟧ + ) + ) + ) + ), + λ ⤍ Package + ⟧, + λ ⤍ Package + ⟧ + ⟧ + } diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested.yaml index f509c5e0c6..fd501e8047 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/nested.yaml @@ -40,7 +40,7 @@ sweet: |- y ↦ ⟦ d ↦ ξ.ρ.ρ.a, z ↦ ⟦ - five ↦ ξ.ρ.ρ.ρ.ρ.main(5), + five ↦ Φ.main(5), b ↦ ξ.ρ.ρ.ρ.a, e ↦ ξ.ρ.d ⟧ @@ -57,7 +57,7 @@ salty: |- y ↦ ⟦ d ↦ ξ.ρ.ρ.a, z ↦ ⟦ - five ↦ ξ.ρ.ρ.ρ.ρ.main( + five ↦ Φ.main( α0 ↦ Φ.org.eolang.number( α0 ↦ Φ.org.eolang.bytes( α0 ↦ ⟦ Δ ⤍ 40-14-00-00-00-00-00-00 ⟧ diff --git a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/string-part.yaml b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/string-part.yaml index 07165ccf0b..d7d0cc7002 100644 --- a/eo-parser/src/test/resources/org/eolang/parser/phi-packs/string-part.yaml +++ b/eo-parser/src/test/resources/org/eolang/parser/phi-packs/string-part.yaml @@ -49,8 +49,8 @@ sweet: |- Φ̇.error( Φ̇.txt.sprintf( "Expected %d byte character at %d index, but there are not enough bytes for it: %x", - Φ̇.tuple( - Φ̇.tuple(Φ̇.tuple(Φ̇.tuple.empty, ξ.char-size), ξ.index), ξ.ρ.ρ.as-bytes + Φ̇.tuple.empty.with(ξ.char-size).with(ξ.index).with( + ξ.ρ.ρ.as-bytes ) ) ) @@ -87,15 +87,12 @@ salty: |- α0 ↦ ⟦ Δ ⤍ 45-78-70-65-63-74-65-64-20-25-64-20-62-79-74-65-20-63-68-61-72-61-63-74-65-72-20-61-74-20-25-64-20-69-6E-64-65-78-2C-20-62-75-74-20-74-68-65-72-65-20-61-72-65-20-6E-6F-74-20-65-6E-6F-75-67-68-20-62-79-74-65-73-20-66-6F-72-20-69-74-3A-20-25-78 ⟧ ) ), - α1 ↦ Φ.org.eolang.tuple( - α0 ↦ Φ.org.eolang.tuple( - α0 ↦ Φ.org.eolang.tuple( - α0 ↦ Φ.org.eolang.tuple.empty, - α1 ↦ ξ.char-size - ), - α1 ↦ ξ.index - ), - α1 ↦ ξ.ρ.ρ.as-bytes + α1 ↦ Φ.org.eolang.tuple.empty.with( + α0 ↦ ξ.char-size + ).with( + α0 ↦ ξ.index + ).with( + α0 ↦ ξ.ρ.ρ.as-bytes ) ) ) diff --git a/eo-runtime/README.md b/eo-runtime/README.md index 8522542bd2..242920fa2f 100644 --- a/eo-runtime/README.md +++ b/eo-runtime/README.md @@ -43,7 +43,7 @@ By default, logging within tests is limited since it produces quite extensive logs which affect performance. However, for debugging/analysis purposes extended (debug) logs can be enabled. For that both JUL and Logback levels need to be set to `FINE`. This is -accomplished by amending the following two files: +accomplished by amending the following two files: _test\resources\jul.properties_: ``` @@ -59,7 +59,7 @@ _test\resources\logback.xml_: For the latter `FINE` level must be set to desired object. `Dataized` will produce extensive logging for dataization process and `PhDefault` for -attributes retrieval process. +attributes retrieval process. By default, dataization will be logged up until nesting level 3. If for some reason deeper dataization log is required it can be achieved by jvm property `-Dmax.dataization.log=` diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index 8815afb923..d775fe051d 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -65,7 +65,7 @@ SOFTWARE. ch.qos.logback logback-classic - 1.5.15 + 1.5.16 test diff --git a/eo-runtime/src/main/eo/org/eolang/bytes.eo b/eo-runtime/src/main/eo/org/eolang/bytes.eo index 835d82ee57..3be05948ed 100644 --- a/eo-runtime/src/main/eo/org/eolang/bytes.eo +++ b/eo-runtime/src/main/eo/org/eolang/bytes.eo @@ -34,23 +34,23 @@ [data] > bytes data > @ $ > as-bytes - $.eq 01- > as-bool + eq 01- > as-bool # Turn this chain of eight bytes into a number. # If there are less or more than eight bytes, there will # be an error returned. [] > as-number if. > @ - ^.eq nan.as-bytes + eq nan.as-bytes nan if. - ^.eq positive-infinity.as-bytes + eq positive-infinity.as-bytes positive-infinity if. - ^.eq negative-infinity.as-bytes + eq negative-infinity.as-bytes negative-infinity if. - ^.size.eq 8 + size.eq 8 number ^ error sprintf @@ -58,9 +58,11 @@ * ^ # Equals to another object. + # A condition where two objects have the same value or content. [b] > eq /org.eolang.bool # Total number of bytes. + # The complete count of bytes used to represent data. [] > size /org.eolang.number # Represents a sub-sequence inside the current one. @@ -71,7 +73,7 @@ # be an error returned. [] > as-i64 if. > @ - ^.size.eq 8 + size.eq 8 i64 ^ error sprintf @@ -83,7 +85,7 @@ # be an error returned. [] > as-i32 if. > @ - ^.size.eq 4 + size.eq 4 i32 ^ error sprintf @@ -95,29 +97,29 @@ # be an error returned. [] > as-i16 if. > @ - ^.size.eq 2 + size.eq 2 i16 ^ error sprintf "Can't convert non 2 length bytes to i16, bytes are %x" * ^ - # Calculate bitwise and. + # Calculate the bitwise and operation. [b] > and /org.eolang.bytes - # Calculate bitwise or. + # Calculate the bitwise or operation. [b] > or /org.eolang.bytes - # Calculate bitwise xor. + # Calculate the bitwise xor operation. [b] > xor /org.eolang.bytes - # Calculate bitwise not. + # Calculate the bitwise not operation. [] > not /org.eolang.bytes - # Calculate bitwise left shift. - ^.right x.neg > [x] > left + # Calculate the bitwise left shift. + right x.neg > [x] > left - # Calculate bitwise right shift. + # Calculate the bitwise right shift. [x] > right /org.eolang.bytes # Concatenation of two byte sequences: diff --git a/eo-runtime/src/main/eo/org/eolang/dataized.eo b/eo-runtime/src/main/eo/org/eolang/dataized.eo index 35801659c5..aff7d479d7 100644 --- a/eo-runtime/src/main/eo/org/eolang/dataized.eo +++ b/eo-runtime/src/main/eo/org/eolang/dataized.eo @@ -43,7 +43,7 @@ # # Some 64+ characters comment should be here. # [] > foo # [] > @ -# ^.inner.five > @ +# inner.five > @ # [] > inner # 5 > five # diff --git a/eo-runtime/src/main/eo/org/eolang/false.eo b/eo-runtime/src/main/eo/org/eolang/false.eo index 4edde93fbd..15dc071800 100644 --- a/eo-runtime/src/main/eo/org/eolang/false.eo +++ b/eo-runtime/src/main/eo/org/eolang/false.eo @@ -35,7 +35,9 @@ right > [left right] > if # And. + # A logical operation that returns True only if all given conditions are true. ^ > [x] > and # Or. + # A logical operation that returns True if at least one of the given conditions is true. 01-.eq x > [x] > or diff --git a/eo-runtime/src/main/eo/org/eolang/fs/dir.eo b/eo-runtime/src/main/eo/org/eolang/fs/dir.eo index e3b3b49301..224c095918 100644 --- a/eo-runtime/src/main/eo/org/eolang/fs/dir.eo +++ b/eo-runtime/src/main/eo/org/eolang/fs/dir.eo @@ -31,18 +31,20 @@ # Directory in the file system. # Apparently every directory is a file. [file] > dir + $ > as-dir $.file > @ true > is-directory # Makes a directory together with all required # parent directories and returns the created directory. [] > made - if. > @ - ^.exists - ^ - seq * - mkdir + as-dir. > @ + if. + ^.exists ^ + seq * + mkdir + ^ # Makes a directory together with all required # parent directories. @@ -59,40 +61,38 @@ # Deletes directory and all files in it, recursively. # Returns the deleted directory. [] > deleted - (^.walk "**").at.^ > walked - walked.length > len! - if. > @ - ^.exists - seq * - rec-delete walked 0 + as-dir. > @ + if. + ^.exists + seq * + rec-delete (walk "**").as-tuple + ^ ^ - ^ # Deletes files and directories in current directory recursively. # Returns `true`. # # Attention! The object is for internal usage only, please # don't use the object programmatically outside of `dir` object. - [tup index] > rec-delete + [tup] > rec-delete if. > @ - ^.len.eq index + tup.length.eq 0 true seq * - tup.tail.deleted.exists - ^.rec-delete - tup.head - index.plus 1 + tup.value.deleted + rec-delete tup.prev # Creates an empty temporary file in the current directory. [] > tmpfile - if. > @ - ^.exists - QQ.fs.file - string touch.as-bytes - error - sprintf - "Directory %s does not exist, can't create temporary file" - * ^.path + as-file. > @ + if. + ^.exists + QQ.fs.file + touch.as-bytes + error + sprintf + "Directory %s does not exist, can't create temporary file" + * file # Creates an empty temporary file in the current directory and # returns absolute path to it as `string`. @@ -107,4 +107,4 @@ error > @ sprintf "The file %s is a directory, can't open for I/O operations" - * ^.path + * file diff --git a/eo-runtime/src/main/eo/org/eolang/fs/file.eo b/eo-runtime/src/main/eo/org/eolang/fs/file.eo index aca8e68321..f159249d90 100644 --- a/eo-runtime/src/main/eo/org/eolang/fs/file.eo +++ b/eo-runtime/src/main/eo/org/eolang/fs/file.eo @@ -27,10 +27,14 @@ +rt jvm org.eolang:eo-runtime:0.0.0 +rt node eo2js-runtime:0.0.0 +version 0.0.0 ++unlint broken-ref # The file object in the filesystem. [path] > file + $ > as-file $.path > @ + # Convert the `file` to the `path`. + (QQ.fs.path path).determined > as-path # Returns `true` if current file is a directory, returns `false` otherwise. [] > is-directory /org.eolang.bool @@ -42,12 +46,13 @@ # If current file does not exist - create an empty file # in filesystem and returns it. [] > touched - if. > @ - ^.exists - ^ - seq * - touch + as-file. > @ + if. + exists ^ + seq * + touch + ^ # Creates new empty file. # @@ -58,12 +63,13 @@ # If current file exists - deletes it and returns it. # If current file does not exist - just returns it. [] > deleted - if. > @ - ^.exists - seq * - delete + as-file. > @ + if. + exists + seq * + delete + ^ ^ - ^ # Deletes the file and returns `true`. # @@ -76,8 +82,8 @@ # Move current file to `target`, making and returning a new `file` from it. [target] > moved - QQ.fs.file > @ - string move.as-bytes + as-file. > @ + file move # Tries to move file from `^.path` to `target` # and returns path of moved file as `string`. @@ -87,9 +93,6 @@ # don't use the object programmatically outside of `file` object. [] > move /org.eolang.string - # Convert the `file` to the `path`. - (QQ.fs.path ^.path).determined > [] > as-path - # Opens the file. # # The first argument `mode` defines the operations that are allowed on the file @@ -123,12 +126,12 @@ # closes the file stream and returns an original file object. [mode scope] > open mode > access! - access.eq "r" > read - access.eq "w" > write - access.eq "a" > append - access.eq "r+" > read-write - access.eq "w+" > write-read - access.eq "a+" > read-append + (access.eq "r").as-bool > read + (access.eq "w").as-bool > write + (access.eq "a").as-bool > append + (access.eq "r+").as-bool > read-write + (access.eq "w+").as-bool > write-read + (access.eq "a+").as-bool > read-append as-bool. > can-read or. read.or read-write @@ -143,31 +146,32 @@ read.or read-write as-bool. > truncate write.or write-read - if. > @ - can-read.not.and can-write.not - error "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" + as-file. > @ if. - ^.exists.not - if. - must-exists - error - sprintf - "File must exist for given access mod: '%s'" - * access - seq * - ^.touched.touch - process-file - ^ + can-read.not.and can-write.not + error "Wrong access mod. Only next modes are available: 'r', 'w', 'a', 'r+', 'w+', 'a+'" if. - truncate - seq * - ^.deleted.delete - ^.touched.touch - process-file - ^ - seq * - process-file - ^ + exists.not + if. + must-exists + error + sprintf + "File must exist for given access mod: '%s'" + * access + seq * + touched.touch + process-file + ^ + if. + truncate + seq * + deleted.delete + touched.touch + process-file + ^ + seq * + process-file + ^ # Process current file in the provided scope. # @@ -190,14 +194,14 @@ # Returns new instance of `input-block` with `buffer` read from file, or # returns `error` if access mode does not allow reading operations. [size] > read - ((input-block --).read size).self > @ + ((input-block --).read size).this > @ # File input block # # Attention! The object is for internal usage only, please # don't use the object programmatically outside of `file` object. [buffer] > input-block - $ > self + $ > this buffer > @ # Read `size` amount of bytes from file input stream. @@ -205,18 +209,18 @@ # returns `error` if provided access mode does not allow reading operations. [size] > read ^.^.read-bytes size > read-bytes! - self. > @ + this. > @ if. - ^.^.^.^.can-read.not + can-read.not [] >> - $ > self + $ > this error > @ sprintf "Can't read from file with provided access mode '%s'" - * ^.^.^.^.^.access + * access seq * read-bytes - ^.^.input-block read-bytes + input-block read-bytes # Bytes read from file input stream # @@ -230,14 +234,14 @@ # Returns new instance of `output-block` ready to write again, or # returns an error if provided access mode does not allow writing operations. [buffer] > write - (output-block.write buffer).self > @ + (output-block.write buffer).this > @ # File output block. # # Attention! The object is for internal usage only, please # don't use the object programmatically outside of `file` object. [] > output-block - $ > self + $ > this true > @ # Write given `buffer` to file output stream. @@ -246,18 +250,18 @@ # Returns new instance of `output-block` ready to write again, or # returns an error if provided access mode does not allow writing operations. [buffer] > write - self. > @ + this. > @ if. - ^.^.^.^.can-write.not + can-write.not [] >> - $ > self + $ > this error > @ sprintf "Can't write to file with provided access mode '%s'" - * ^.^.^.^.^.access + * access seq * - ^.^.written-bytes buffer - ^.^.output-block + written-bytes buffer + output-block # Bytes written to file output stream. # diff --git a/eo-runtime/src/main/eo/org/eolang/fs/path.eo b/eo-runtime/src/main/eo/org/eolang/fs/path.eo index bb5336f895..d067baa69e 100644 --- a/eo-runtime/src/main/eo/org/eolang/fs/path.eo +++ b/eo-runtime/src/main/eo/org/eolang/fs/path.eo @@ -20,6 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. ++alias org.eolang.fs.dir ++alias org.eolang.fs.file +alias org.eolang.sys.os +alias org.eolang.structs.list +alias org.eolang.txt.regex @@ -28,6 +30,7 @@ +home https://github.com/objectionary/eo +package org.eolang.fs +version 0.0.0 ++unlint broken-ref # A `path` represents a path that is hierarchical and composed of a sequence of # directory and file name elements separated by a special separator or delimiter. @@ -46,13 +49,13 @@ string > joined-path as-bytes. joined. - text ^.separator + text separator paths normalized. > @ if. os.is-windows - ^.win32 joined-path - ^.posix joined-path + win32 joined-path + posix joined-path # The system-dependent default name-separator character. # On UNIX systems the value of this field is "/"; @@ -60,29 +63,30 @@ [] > separator if. > @ os.is-windows - ^.win32.separator - ^.posix.separator + win32.separator + posix.separator # POSIX specified path. + # A standardized way to represent file or directory locations in a Unix-like system. [uri] > posix $ > determined "/" > separator - (QQ.fs.file uri).size.^ > as-file - (QQ.fs.dir (QQ.fs.file uri)).made.^ > as-dir + (file uri).as-file > as-file + (dir (QQ.fs.file uri)).as-dir > as-dir uri > @ # Returns `true` if current path is absolute - starts with '/' char. [] > is-absolute and. > @ - ^.uri.length.gt 0 - (^.uri.as-bytes.slice 0 1).eq ^.separator + uri.length.gt 0 + (uri.as-bytes.slice 0 1).eq separator # Return new `path` with normalized uri. # Normalization includes: # - converting multiple slashes into a single slash. # - resolving "." (current directory) and ".." (parent directory) segments. [] > normalized - ^.uri.as-bytes > uri-as-bytes + uri > uri-as-bytes! ^.is-absolute.as-bool > is-absolute and. > has-trailing-slash uri-as-bytes.size.gt 0 @@ -90,14 +94,14 @@ uri-as-bytes.slice uri-as-bytes.size.plus -1 1 - ^.separator + separator joined. > path - text ^.separator + text separator reduced. list split. - text ^.uri - ^.separator + text uri + separator * [accum segment] >> if. > @ @@ -105,10 +109,10 @@ if. and. accum.length.gt 0 - (accum.tail.eq "..").not - accum.head + (accum.value.eq "..").not + accum.prev if. - ^.is-absolute.not + is-absolute.not accum.with segment accum if. @@ -119,19 +123,19 @@ accum.with segment as-bytes. > normalized if. - ^.uri.length.eq 0 + uri.length.eq 0 "." concat. if. is-absolute - ^.separator.concat path + separator.concat path path if. has-trailing-slash - ^.separator + separator -- determined. > @ - ^.^.posix + posix if. normalized.eq "//" "/" @@ -155,15 +159,15 @@ [other] > resolved other.as-bytes > other-as-bytes normalized. > @ - ^.^.posix + posix string if. - (other-as-bytes.slice 0 1).eq ^.separator + (other-as-bytes.slice 0 1).eq separator other-as-bytes concat. concat. - ^.uri - ^.separator + uri + separator other-as-bytes # Takes the base name from the provided `path`, for example: @@ -182,11 +186,11 @@ # is "/" (regular slash) in Unix OS: # With the `path` "/tmp/var/hello\world" `base-name` returns `hello\world`. [] > basename - ^.uri > pth! + uri > pth! text > txt string pth plus. > slice-start-idx! - txt.last-index-of ^.separator + txt.last-index-of separator 1 string > @ if. @@ -215,7 +219,7 @@ # and returns substring after "." if it's found. # If it's not - empty string is returned. [] > extname - ^.basename > base! + basename > base! text > txt string base txt.last-index-of "." > slice-start-idx! @@ -248,10 +252,10 @@ # is "/" (regular slash) in Unix OS: # With the `path` "/tmp/v\a\r/hello" `dir-name` returns `/tmp/v\a\r`. [] > dirname - ^.uri > pth! + uri > pth! text > txt string pth - txt.last-index-of ^.separator > len! + txt.last-index-of separator > len! string > @ if. or. @@ -281,8 +285,8 @@ [uri] > validated $ > determined ^.separator > separator - (QQ.fs.file uri).size.^ > as-file - (QQ.fs.dir (QQ.fs.file uri)).made.^ > as-dir + (file uri).as-file > as-file + (dir (file uri)).as-dir > as-dir uri > @ # Returns `true` if given `uri` is drive relative which means it @@ -295,7 +299,7 @@ uri > uri-as-bytes! and. > @ uri-as-bytes.size.gt 0 - (uri-as-bytes.slice 0 1).eq ^.separator + (uri-as-bytes.slice 0 1).eq separator # Replaces slashes '/' with valid windows separator '\'. [uri] > separated-correctly @@ -304,7 +308,7 @@ string uri-as-bytes pth.replaced > replaced! regex "/\\//" - ^.separator + separator if. > @ (pth.index-of path.posix.separator).eq -1 string uri-as-bytes @@ -319,10 +323,10 @@ uri-as-bytes.size.eq 0 false or. - ^.is-root-relative uri-as-bytes + is-root-relative uri-as-bytes and. uri-as-bytes.size.gt 1 - ^.is-drive-relative uri-as-bytes + is-drive-relative uri-as-bytes # Return new `path` with normalized uri. # Normalization includes: @@ -330,7 +334,7 @@ # - resolving "." (current directory) and ".." (parent directory) segments. # - handling of drive letters in Windows. [] > normalized - ^.uri > uri-as-bytes! + uri > uri-as-bytes! (^.is-drive-relative uri-as-bytes).as-bool > is-drive-relative (^.is-root-relative uri-as-bytes).as-bool > is-root-relative if. > driveless! @@ -345,9 +349,9 @@ uri-as-bytes.slice uri-as-bytes.size.plus -1 1 - ^.separator + separator joined. > path! - text ^.separator + text separator reduced. list split. @@ -360,12 +364,12 @@ if. and. accum.length.gt 0 - (accum.tail.eq "..").not - accum.head + (accum.value.eq "..").not + accum.prev if. and. - ^.is-root-relative.not - ^.is-drive-relative.not + is-root-relative.not + is-drive-relative.not accum.with segment accum if. @@ -383,23 +387,23 @@ if. is-drive-relative if. - (driveless.slice 0 1).eq ^.separator - ^.uri.slice 0 3 - ^.uri.slice 0 2 + (driveless.slice 0 1).eq separator + uri.slice 0 3 + uri.slice 0 2 if. is-root-relative - ^.separator + separator -- path if. has-trailing-slash - ^.separator + separator -- determined. > @ - ^.^.validated + validated if. normalized.eq "\\\\" - ^.separator + separator string normalized # Resolves `other` path against `^.uri` and returns as new `path` from it. @@ -424,12 +428,12 @@ # |--------------------|----------------|-------------------| # URI Resolution Rules. [other] > resolved - ^.uri > uri-as-bytes! - ^.separated-correctly other > valid-other! + uri > uri-as-bytes! + separated-correctly other > valid-other! (^.is-drive-relative valid-other).as-bool > other-is-drive-relative (^.is-root-relative valid-other).as-bool > other-is-root-relative normalized. > @ - ^.^.validated + validated string if. other-is-drive-relative @@ -437,7 +441,7 @@ if. other-is-root-relative if. - ^.is-drive-relative uri-as-bytes + is-drive-relative uri-as-bytes concat. uri-as-bytes.slice 0 2 valid-other @@ -445,7 +449,7 @@ concat. concat. uri-as-bytes - ^.separator + separator valid-other # Takes the base name from the provided `path`, for example: @@ -464,11 +468,11 @@ # is "/" (regular slash) in Unix OS: # With the `path` "/tmp/var/hello\world" `base-name` returns `hello\world`. [] > basename - ^.uri > pth! + uri > pth! text > txt string pth plus. > slice-start-idx! - txt.last-index-of ^.separator + txt.last-index-of separator 1 string > @ if. @@ -497,7 +501,7 @@ # and returns substring after "." if it's found. # If it's not - empty string is returned. [] > extname - ^.basename > base! + basename > base! text > txt string base txt.last-index-of "." > slice-start-idx! @@ -526,10 +530,10 @@ # |------------------------------|--------------------| # Extracting Directory Names from File Paths. [] > dirname - ^.uri > pth! + uri > pth! text > txt string pth - txt.last-index-of ^.separator > len! + txt.last-index-of separator > len! string > @ if. or. diff --git a/eo-runtime/src/main/eo/org/eolang/fs/tmpdir.eo b/eo-runtime/src/main/eo/org/eolang/fs/tmpdir.eo index 9faabbd731..cce5dc8cc1 100644 --- a/eo-runtime/src/main/eo/org/eolang/fs/tmpdir.eo +++ b/eo-runtime/src/main/eo/org/eolang/fs/tmpdir.eo @@ -28,6 +28,7 @@ +home https://github.com/objectionary/eo +package org.eolang.fs +version 0.0.0 ++unlint broken-ref # Temporary directory. # For Unix/MacOS uses the path supplied by the first environment variable @@ -38,37 +39,39 @@ # takes the first environment variable in the list TMP, TEMP, USERPROFILE. # If none of these are found, it returns the Windows directory (C:\Windows). [] > tmpdir - dir > @ - file - string - [] > os-tmp-dir! - getenv "TMPDIR" > tmpdir! - getenv "TMP" > tmp! - getenv "TEMP" > temp! - getenv "TEMPDIR" > tempdir! - getenv "USERPROFILE" > userprofile! - if. > @ - os.is-windows - if. - tmp.eq "" + as-dir. > @ + dir + file + string + [] > os-tmp-dir! + getenv "TMPDIR" > tmpdir! + getenv "TMP" > tmp! + getenv "TEMP" > temp! + getenv "TEMPDIR" > tempdir! + getenv "USERPROFILE" > userprofile! + -- > empty + if. > @ + os.is-windows if. - temp.eq "" + tmp.eq empty if. - userprofile.eq "" - "C:\\Windows" - userprofile - temp - tmp - if. - tmpdir.eq "" - if. - tmp.eq "" - if. - temp.eq "" + temp.eq empty if. - tempdir.eq "" - "/tmp" - tempdir + userprofile.eq empty + "C:\\Windows" + userprofile temp tmp - tmpdir + if. + tmpdir.eq empty + if. + tmp.eq empty + if. + temp.eq empty + if. + tempdir.eq empty + "/tmp" + tempdir + temp + tmp + tmpdir diff --git a/eo-runtime/src/main/eo/org/eolang/go.eo b/eo-runtime/src/main/eo/org/eolang/go.eo index d183dba227..eb500f5e90 100644 --- a/eo-runtime/src/main/eo/org/eolang/go.eo +++ b/eo-runtime/src/main/eo/org/eolang/go.eo @@ -24,6 +24,7 @@ +home https://github.com/objectionary/eo +package org.eolang +version 0.0.0 ++unlint broken-ref # Non-conditional forward and backward jumps. # Forward jump instantly returns provided object to `g.forward` without touching @@ -53,7 +54,7 @@ # ``` # Go to. [] > go - malloc.of > id! + malloc.of > identifier! 8 m.put m.id > [m] @@ -62,7 +63,7 @@ body token [e] >> if. > @ - ^.^.id.eq e.id + identifier.eq e.id e.value error e true @@ -70,12 +71,12 @@ [] > token error > backward jump - ^.^.to ^.body + to body [value] > jump - ^.^.^.id > id + identifier > id [res] > forward error > @ - ^.jump + jump res diff --git a/eo-runtime/src/main/eo/org/eolang/i16.eo b/eo-runtime/src/main/eo/org/eolang/i16.eo index 9c24b60dee..f7f2ca667a 100644 --- a/eo-runtime/src/main/eo/org/eolang/i16.eo +++ b/eo-runtime/src/main/eo/org/eolang/i16.eo @@ -33,9 +33,9 @@ [as-bytes] > i16 as-bytes > @ $ > as-i16 - $.times -1.as-i64.as-i32.as-i16 > neg - $.as-i32.as-i64 > as-i64 - $.as-i64.as-number > as-number + times -1.as-i64.as-i32.as-i16 > neg + as-i32.as-i64 > as-i64 + as-i64.as-number > as-number # Convert this `i16` to `i32`. # The object is an atom because it's not possible to check what diff --git a/eo-runtime/src/main/eo/org/eolang/i32.eo b/eo-runtime/src/main/eo/org/eolang/i32.eo index 661d022ed9..5c51d548ea 100644 --- a/eo-runtime/src/main/eo/org/eolang/i32.eo +++ b/eo-runtime/src/main/eo/org/eolang/i32.eo @@ -33,8 +33,8 @@ [as-bytes] > i32 as-bytes > @ $ > as-i32 - $.times -1.as-i64.as-i32 > neg - $.as-i64.as-number > as-number + times -1.as-i64.as-i32 > neg + as-i64.as-number > as-number # Convert this `i32` to `i64`. # The object is an atom because it's not possible to check what @@ -46,37 +46,37 @@ # The `error` is returned if the `i32` number is more than # max `i16` value `32767`. [] > as-i16 - (^.as-bytes.slice 0 2).as-bytes > left + (as-bytes.slice 0 2).as-bytes > left if. > @ or. left.eq 00-00 left.eq FF-FF - i16 (^.as-bytes.slice 2 2) + i16 (as-bytes.slice 2 2) error sprintf "Can't convert i32 number %d to i16 because it's out of i16 bounds" - * ^.as-i64.as-number + * as-i64.as-number # Returns `true` if `$` < `x`. # Here `x` must be an `i32` object. - ^.as-i64.lt x.as-i32.as-i64 > [x] > lt + as-i64.lt x.as-i32.as-i64 > [x] > lt # Returns `true` if `$` <= `x`. # Here `x` must be an `i32` object. - ^.as-i64.lte x.as-i32.as-i64 > [x] > lte + as-i64.lte x.as-i32.as-i64 > [x] > lte # Returns `true` if `$` > `x`. # Here `x` must be an `i32` object. - ^.as-i64.gt x.as-i32.as-i64 > [x] > gt + as-i64.gt x.as-i32.as-i64 > [x] > gt # Returns `true` if `$` >= `x`. # Here `x` must be an `i32` object. - ^.as-i64.gte x.as-i32.as-i64 > [x] > gte + as-i64.gte x.as-i32.as-i64 > [x] > gte # Multiplication of `$` and `x`. # Here `x` must be an `i32` object. [x] > times - (^.as-i64.times x.as-i32.as-i64).as-bytes > bts + (as-i64.times x.as-i32.as-i64).as-bytes > bts bts.slice 0 4 > left bts.slice 4 4 > right if. > @ @@ -91,7 +91,7 @@ # Sum of `$` and `x`. # Here `x` must be an `i32` object. [x] > plus - (^.as-i64.plus x.as-i32.as-i64).as-bytes > bts + (as-i64.plus x.as-i32.as-i64).as-bytes > bts bts.slice 0 4 > left bts.slice 4 4 > right if. > @ @@ -105,14 +105,14 @@ # Subtraction between `$` and `x`. # Here `x` must be an `i32` object. - ^.plus x.as-i32.neg > [x] > minus + plus x.as-i32.neg > [x] > minus # Quotient of the division of `$` by `x`. # Here `x` must be an `i32` object. # An `error` is returned if or `x` is equal to 0. [x] > div x.as-i32 > x-as-i32 - (^.as-i64.div x-as-i32.as-i64).as-bytes > bts + (as-i64.div x-as-i32.as-i64).as-bytes > bts bts.slice 0 4 > left bts.slice 4 4 > right 00-00-00-00 > zero @@ -121,7 +121,7 @@ error sprintf "Can't divide %d by i32 zero" - * ^.as-i64.as-number + * as-i64.as-number if. or. left.eq zero diff --git a/eo-runtime/src/main/eo/org/eolang/i64.eo b/eo-runtime/src/main/eo/org/eolang/i64.eo index a101961db2..539755b75d 100644 --- a/eo-runtime/src/main/eo/org/eolang/i64.eo +++ b/eo-runtime/src/main/eo/org/eolang/i64.eo @@ -33,23 +33,23 @@ [as-bytes] > i64 as-bytes > @ $ > as-i64 - $.times -1.as-i64 > neg - $.as-i32.as-i16 > as-i16 + times -1.as-i64 > neg + as-i32.as-i16 > as-i16 # Convert this `i64` to `i32`. # The `error` is returned if the `i64` number is more than # max `i32` value `2147483647`. [] > as-i32 - (^.as-bytes.slice 0 4).as-bytes > left + (as-bytes.slice 0 4).as-bytes > left if. > @ or. left.eq 00-00-00-00 left.eq FF-FF-FF-FF - i32 (^.as-bytes.slice 4 4) + i32 (as-bytes.slice 4 4) error sprintf "Can't convert i64 number %d to i32 because it's out of i32 bounds" - * ^.as-number + * as-number # Convert this `i64` to `number` object. [] > as-number /org.eolang.number @@ -59,7 +59,7 @@ [x] > lt x > value! 0.as-i64.gt > @ - ^.minus + minus i64 value # Returns `true` if `$` <= `x`. @@ -67,7 +67,7 @@ [x] > lte x > value! or. > @ - ^.lt value + lt value ^.eq value # Returns `true` if `$` > `x`. @@ -79,7 +79,7 @@ [x] > gte x > value! or. > @ - ^.gt value + gt value ^.eq value # Multiplication of `$` and `x`. @@ -94,8 +94,7 @@ # Here `x` must be an `i64` object. [x] > minus x > value! - ^.plus > @ - (i64 value).neg + plus (i64 value).neg > @ # Quotient of the division of `$` by `x`. # Here `x` must be an `i64` object. diff --git a/eo-runtime/src/main/eo/org/eolang/io/bytes-as-input.eo b/eo-runtime/src/main/eo/org/eolang/io/bytes-as-input.eo index 7ef11ce76c..3e299a4e2a 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/bytes-as-input.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/bytes-as-input.eo @@ -52,7 +52,7 @@ # Returns new instance of `input-block` with set # sliced `data` and `buffer`. [size] > read - ((input-block ^.bts --).read size).self > @ + ((input-block bts --).read size).self > @ # Bytes-as-input block. # @@ -70,7 +70,7 @@ # sliced `data` and `buffer`. [size] > read size > to-read! - ^.data.size > available! + data.size > available! if. > next! gt. number available @@ -80,12 +80,12 @@ self. > @ if. available.eq 0 - ^.^.input-block -- -- - ^.^.input-block + input-block -- -- + input-block as-bytes. - ^.data.slice + data.slice next (number available).minus number next as-bytes. - ^.data.slice 0 next + data.slice 0 next diff --git a/eo-runtime/src/main/eo/org/eolang/io/console.eo b/eo-runtime/src/main/eo/org/eolang/io/console.eo index 1860ec8109..509d4c1a5d 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/console.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/console.eo @@ -118,7 +118,7 @@ self. > @ seq * read-bytes - ^.^.input-block read-bytes + input-block read-bytes # Write given `buffer` to console. # Here `buffer` is either sequence of bytes or and object that can be @@ -144,7 +144,7 @@ posix "write" * posix.stdout-fileno buffer buffer.size - ^.^.output-block + output-block # Windows console. # It uses kernel32.dll system function calls to read/write standard inputs/outputs. @@ -174,7 +174,7 @@ self. > @ seq * read-bytes - ^.^.input-block read-bytes + input-block read-bytes # Write given `buffer` to console. # Here `buffer` is either sequence of bytes or and object that can be @@ -200,4 +200,4 @@ win32 "WriteFile" * win32.std-output-handle buffer buffer.size - ^.^.output-block + output-block diff --git a/eo-runtime/src/main/eo/org/eolang/io/dead-input.eo b/eo-runtime/src/main/eo/org/eolang/io/dead-input.eo index f4cd78e2a2..d170617b96 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/dead-input.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/dead-input.eo @@ -42,4 +42,4 @@ # Read `size` amount of bytes from nowhere. # Returns new instance of `input-block`. - ^.^.input-block > [size] > read + input-block > [size] > read diff --git a/eo-runtime/src/main/eo/org/eolang/io/dead-output.eo b/eo-runtime/src/main/eo/org/eolang/io/dead-output.eo index b4efa3d7c5..90fcb3ce29 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/dead-output.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/dead-output.eo @@ -41,4 +41,4 @@ # Writes given `buffer` to nowhere. # Returns new instance of `output-block`. - ^.^.output-block > [buffer] > write + output-block > [buffer] > write diff --git a/eo-runtime/src/main/eo/org/eolang/io/input-length.eo b/eo-runtime/src/main/eo/org/eolang/io/input-length.eo index 026d320d29..e7dd64619b 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/input-length.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/input-length.eo @@ -31,10 +31,10 @@ rec-read input 0 > @ [input length] > rec-read - (input.read ^.chunk).read.^ > read-bytes + (input.read chunk).read.^ > read-bytes if. > @ read-bytes.size.eq 0 length - ^.rec-read + rec-read read-bytes length.plus read-bytes.size diff --git a/eo-runtime/src/main/eo/org/eolang/io/malloc-as-output.eo b/eo-runtime/src/main/eo/org/eolang/io/malloc-as-output.eo index 23ebbacf11..786f75629b 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/malloc-as-output.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/malloc-as-output.eo @@ -66,6 +66,6 @@ [buffer] > write self. > @ seq * - ^.^.^.allocated.write offset buffer - ^.^.output-block + allocated.write offset buffer + output-block offset.plus buffer.size diff --git a/eo-runtime/src/main/eo/org/eolang/io/stdin.eo b/eo-runtime/src/main/eo/org/eolang/io/stdin.eo index d789ebdfb6..51a44c4365 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/stdin.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/stdin.eo @@ -47,7 +47,7 @@ # Consumes all lines from the standard input stream. # There's no line to consume - returns an empty string. [] > all-lines - rec-read ^.next-line -- true > @ + rec-read next-line -- true > @ line-separator > separator! # Recursive reading from console by one line. @@ -58,12 +58,12 @@ if. > @ line.length.eq 0 string buffer - ^.rec-read - ^.^.next-line + rec-read + next-line if. first buffer.concat line - (buffer.concat ^.separator).concat line + (buffer.concat separator).concat line false # Consumes only one line from the standard input stream. @@ -91,6 +91,6 @@ next.as-bytes.eq "\n" char.eq "\n" string buffer - ^.rec-read + rec-read next buffer.concat char diff --git a/eo-runtime/src/main/eo/org/eolang/io/tee-input.eo b/eo-runtime/src/main/eo/org/eolang/io/tee-input.eo index e75b828f1f..7b0d836e17 100644 --- a/eo-runtime/src/main/eo/org/eolang/io/tee-input.eo +++ b/eo-runtime/src/main/eo/org/eolang/io/tee-input.eo @@ -45,7 +45,7 @@ # Returns new instance of `input-block` with set # `input` ready to be read, `output` ready to be written and bytes `buffer`. [size] > read - ((input-block ^.input ^.output --).read size).self > @ + ((input-block input output --).read size).self > @ # Tee-input block. # @@ -63,12 +63,12 @@ # Returns new instance of `input-block` with set # `input` ready to be read, `output` ready to be written and bytes `buffer`. [size] > read - (^.input.read size).read.^ > read-bytes - (^.output.write read-bytes).write.^ > written-bytes + (input.read size).read.^ > read-bytes + (output.write read-bytes).write.^ > written-bytes self. > @ seq * written-bytes - ^.^.input-block + input-block read-bytes written-bytes read-bytes.as-bytes diff --git a/eo-runtime/src/main/eo/org/eolang/malloc.eo b/eo-runtime/src/main/eo/org/eolang/malloc.eo index e0b009bb77..8e566a98fa 100644 --- a/eo-runtime/src/main/eo/org/eolang/malloc.eo +++ b/eo-runtime/src/main/eo/org/eolang/malloc.eo @@ -26,6 +26,7 @@ +rt jvm org.eolang:eo-runtime:0.0.0 +rt node eo2js-runtime:0.0.0 +version 0.0.0 ++unlint broken-ref # The `malloc` object is an abstraction of a storage of data in heap # memory. The implementation of `malloc` is platform dependent. It may @@ -95,8 +96,8 @@ bts.size [m] >> seq * > @ - m.write 0 ^.bts - ^.scope m + m.write 0 bts + scope m # Allocates block in memory of given `size`. After allocation the `size` zero bytes bytes are # written into memory. @@ -121,9 +122,9 @@ # to the block with offset `target`. # Returns `true` on success, or `error` on failure. [source target length] > copy - ^.write > @ + write > @ target - ^.read source length + read source length # Read `length` bytes with `offset` from the allocated block in memory. [offset length] > read /org.eolang.bytes @@ -134,5 +135,5 @@ # Put `object` into the allocated block in memory. The `object` is supposed to be dataizable. [object] > put seq * > @ - ^.write 0 object - ^.get + write 0 object + get diff --git a/eo-runtime/src/main/eo/org/eolang/math/angle.eo b/eo-runtime/src/main/eo/org/eolang/math/angle.eo index 8fe1d4002d..533705e4ae 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/angle.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/angle.eo @@ -29,12 +29,14 @@ +version 0.0.0 # The angle. +# A measure of how much something is tilted or rotated, measured in degrees or radians. +# When dataized, it shows direction or how two lines meet. [value] > angle value > @ # Converts this from radians to degrees. angle > in-degrees div. - ^.times 180.0 + $.times 180.0 pi # Converts this from degrees to radians. angle > in-radians @@ -53,18 +55,17 @@ # Tangent of current angle. # Please note, that `tan` is calculated from the angle in radians. [] > tan - ^.cos > cosine! + cos > cosine! if. > @ cosine.eq 0 nan - ^.sin.div cosine + sin.div cosine # Cotangent of current angle. # Please note, that `ctan` is calculated from the angle in radians. [] > ctan - ^.sin > sine! + sin > sine! if. > @ sine.eq 0 nan - ^.cos.div sine - + cos.div sine diff --git a/eo-runtime/src/main/eo/org/eolang/math/e.eo b/eo-runtime/src/main/eo/org/eolang/math/e.eo index dc90e0690f..3e547e9869 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/e.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/e.eo @@ -26,4 +26,6 @@ +version 0.0.0 # The Euler's number. +# A fundamental mathematical constant approximately equal to 2.7182818284590452354. +# When dataized, it represents the base of natural logarithms. 2.7182818284590452354 > e diff --git a/eo-runtime/src/main/eo/org/eolang/math/integral.eo b/eo-runtime/src/main/eo/org/eolang/math/integral.eo index beadca91a6..4b7e5a7abb 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/integral.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/integral.eo @@ -24,6 +24,7 @@ +home https://github.com/objectionary/eo +package org.eolang.math +version 0.0.0 ++unlint broken-ref # Counts integral from `a` to `b`. # Here `func` is integration function, `a` is an upper limit, @@ -35,37 +36,37 @@ b.minus a 6.0 plus. - ^.fun a + fun a plus. times. 4.0 - ^.fun + fun times. 0.5 a.plus b - ^.fun b + fun b as-number. > @ malloc.of 8 [sum] >> malloc.for > @ - ^.a + a [left] >> - ^.^.b > right - ((right.minus left).div ^.^.n).as-number > step + b > right + ((right.minus left).div n).as-number > step seq * > @ while [i] >> if. > @ - (^.left.as-number.plus ^.step).lt ^.right + (left.as-number.plus step).lt right seq * - ^.^.sum.put - ^.^.sum.as-number.plus - ^.^.^.subsection - ^.left.as-number - ^.left.as-number.plus ^.step - ^.left.put - ^.left.as-number.plus ^.step + sum.put + sum.as-number.plus + subsection + left.as-number + left.as-number.plus step + left.put + left.as-number.plus step true false true > [i] diff --git a/eo-runtime/src/main/eo/org/eolang/math/numbers.eo b/eo-runtime/src/main/eo/org/eolang/math/numbers.eo index 01d03ccfe1..30209b6d38 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/numbers.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/numbers.eo @@ -33,7 +33,7 @@ # Find max element in the numbers sequence. [] > max - list ^.sequence > lst + list sequence > lst if. > @ lst.is-empty error "Can't get max number from empty sequence" @@ -48,7 +48,7 @@ # Find min element in the numbers sequence. [] > min - list ^.sequence > lst + list sequence > lst if. > @ lst.is-empty error "Can't get min number from empty sequence" diff --git a/eo-runtime/src/main/eo/org/eolang/math/random.eo b/eo-runtime/src/main/eo/org/eolang/math/random.eo index ccd60ceed2..d306029d73 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/random.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/random.eo @@ -80,15 +80,9 @@ as-i64. if. os.is-windows - milliseconds. - win32 - "GetSystemTime" - * win32.system-time + (win32 "GetSystemTime" *).milliseconds [] - output. > timeval - posix - "gettimeofday" - * posix.timeval + (posix "gettimeofday" *).output > timeval plus. > @ timeval.tv-sec.times 1000 as-number. diff --git a/eo-runtime/src/main/eo/org/eolang/math/real.eo b/eo-runtime/src/main/eo/org/eolang/math/real.eo index cfce3b224d..46ae0a5cc4 100644 --- a/eo-runtime/src/main/eo/org/eolang/math/real.eo +++ b/eo-runtime/src/main/eo/org/eolang/math/real.eo @@ -35,8 +35,9 @@ (QQ.math.real e).pow num > exp # Calculate MOD. + # An operation that finds the remainder after dividing one number by another. [x] > mod - number ^.num.as-bytes > dividend + number num.as-bytes > dividend number x.as-bytes > divisor if. > @ divisor.eq 0 @@ -47,8 +48,8 @@ abs-mod.neg [] > abs-mod - (QQ.math.real ^.dividend).abs > dividend-abs - (QQ.math.real ^.divisor).abs > divisor-abs + (QQ.math.real dividend).abs > dividend-abs + (QQ.math.real divisor).abs > divisor-abs minus. > @ dividend-abs divisor-abs.times @@ -57,13 +58,14 @@ # Absolute value of `num` (i.e., with no sign). [] > abs - number ^.num.as-bytes > value + number num.as-bytes > value if. > @ value.gte 0 value value.neg # Make `^.num` power `x`. + # An operation that raises ^.num (a number) to the power of x. [x] > pow /org.eolang.number # Returns the positive square root of a `num`. @@ -76,4 +78,5 @@ [] > acos /org.eolang.number # Calculates arc sine of a `num`. + # An operation that finds the angle whose sine is num. [] > asin /org.eolang.number diff --git a/eo-runtime/src/main/eo/org/eolang/negative-infinity.eo b/eo-runtime/src/main/eo/org/eolang/negative-infinity.eo index 0978f26f62..0ea5d01dcc 100644 --- a/eo-runtime/src/main/eo/org/eolang/negative-infinity.eo +++ b/eo-runtime/src/main/eo/org/eolang/negative-infinity.eo @@ -26,6 +26,8 @@ +version 0.0.0 # Negative infinity. +# A special floating-point value representing an unbounded quantity less than all real numbers. +# When dataized, it signifies an unbounded lower limit or an unreachable maximum value. [] > negative-infinity number FF-F0-00-00-00-00-00-00 > @ $ > floor @@ -35,33 +37,33 @@ false > is-integer error "Can't convert negative infinity to i64" > as-i64 - # Tests that $ = x. + # Tests that the value $ is equal to x. [x] > eq eq. > @ ^.as-bytes x.as-bytes - # Tests that $ < x. + # Tests that the value $ less than x. [x] > lt x > value! not. > @ or. (number value).is-nan - ^.eq value + eq value - # Tests that $ <= x. + # Tests that the value $ less or equal than x. [x] > lte x > value! not. > @ (number value).is-nan - # Tests that $ > x. + # Tests that the value $ greater than x. false > [x] > gt - # Tests that $ >= x. - ^.eq x > [x] > gte + # Tests that the value $ greater or equal than x. + eq x > [x] > gte - # Multiplication of $ and x. + # Returns the result of the multiplication of $ and x. [x] > times x > value! number value > num @@ -75,7 +77,7 @@ ^ positive-infinity - # Sum of $ and x. + # Returns the result of the sum of $ and x. [x] > plus x > value! if. > @ @@ -85,7 +87,7 @@ nan ^ - # Difference between $ and x. + # Difference between the values of $ and x. [x] > minus x > value! if. > @ diff --git a/eo-runtime/src/main/eo/org/eolang/net/socket.eo b/eo-runtime/src/main/eo/org/eolang/net/socket.eo index 2ba1111eed..1809240ca2 100644 --- a/eo-runtime/src/main/eo/org/eolang/net/socket.eo +++ b/eo-runtime/src/main/eo/org/eolang/net/socket.eo @@ -28,6 +28,7 @@ +home https://github.com/objectionary/eo +package org.eolang.net +version 0.0.0 ++unlint broken-ref # Socket. # @@ -118,11 +119,11 @@ # Read `size` amount of bytes from socket. # Returns new instance of `input-block` with `buffer` read from socket. [size] > read - (^.^.^.recv size).as-bytes > read-bytes + (recv size).as-bytes > read-bytes self. > @ seq * read-bytes - ^.^.input-block read-bytes + input-block read-bytes # Makes an `output` from posix socket. # The object allows to use `socket` as output stream and `write` to it sequentially. @@ -151,8 +152,8 @@ [buffer] > write self. > @ seq * - ^.^.^.send buffer - ^.^.output-block + send buffer + output-block # Posix platform specified socket. # @@ -176,7 +177,7 @@ inet-addr.as-i32 posix.sockaddr-in > sockaddr posix.af-inet.as-i16 - ^.htons port + htons port inet-addr-as-int # Scoped posix socket that is passed as argument @@ -185,10 +186,10 @@ [sockfd] > scoped-socket # Makes an `input` from `socket`. # The object allows to use `socket` as input stream and `read` from it sequentially. - ^.^.^.as-input recv > as-input + as-input recv > as-input # Makes an `output` from posix socket. # The object allows to use `socket` as output stream and `write` to it sequentially. - ^.^.^.as-output send > as-output + as-output send > as-output # Send bytes through the socket. # Here `buffer` must be an object that can be dataized. @@ -198,13 +199,13 @@ code. > sent posix "send" - * ^.sockfd buff buff.size 0 + * sockfd buff buff.size 0 if. > @ sent.eq -1 error sprintf "Failed to send message through the socket '%d', reason: %s" - * ^.sockfd ^.^.strerror.code + * sockfd strerror.code sent # Receive bytes from the socket. @@ -214,13 +215,13 @@ called. > received posix "recv" - * ^.sockfd size 0 + * sockfd size 0 if. > @ received.code.eq -1 error sprintf "Failed to receive data from the socket '%d', reason: %s" - * ^.sockfd ^.^.strerror.code + * sockfd strerror.code received.output # Get error message as `string` from ERRNO. @@ -247,7 +248,7 @@ error sprintf "Couldn't close a posix socket '%d', reason: '%s'" - * sockfd ^.strerror.code + * sockfd strerror.code true # Safe posix socket that ensures that socket is closed even if error is occurred. @@ -256,21 +257,21 @@ # the object programmatically outside of `socket` object. [scope] > safe-socket if. > @ - ^.sd.eq -1 + sd.eq -1 error sprintf "Couldn't create a posix socket, reason: '%s'" - * ^.strerror.code + * strerror.code try scope error ex > [ex] - ^.closed-socket ^.sd + closed-socket sd # Initiate a connection on a socket. # Here `scope` must be an abstract object with one free attribute which will be # set to `scoped-socket` object and used as connector for socket messaging. [scope] > connect - ^.safe-socket > @ + safe-socket > @ [] >> ^.^ > sock code. > connected @@ -294,7 +295,7 @@ # this free attribute is set to abstract object which decorates `scoped-socket` and also # has attribute `accept` to accept other socket connections. [scope] > listen - ^.safe-socket > @ + safe-socket > @ [] >> ^.^ > sock code. > bound @@ -321,14 +322,13 @@ dataized scope [] >> - ^.sock.scoped-socket ^.sock.sd > @ + sock.scoped-socket sock.sd > @ # Accept incoming connection on socket # On success the client socket is returned, otherwise `error` is returned. # Client socket decorates `scoped-socket` object, so all the attributes like # `send`, `recv`, `as-input`, `as-output` are available. [scope] > accept - ^.^.sock > sock code. > client-sockfd posix "accept" @@ -370,7 +370,7 @@ inet-addr.as-i32 win32.sockaddr-in > sockaddr win32.af-inet.as-i16 - ^.htons port + htons port inet-addr-as-int # Scoped win32 socket that is passed as argument @@ -379,10 +379,10 @@ [sockfd] > scoped-socket # Makes an `input` from win32 `socket`. # The object allows to use `socket` as input stream and `read` from it sequentially. - ^.^.^.as-input recv > as-input + as-input recv > as-input # Makes an `output` from win32 socket. # The object allows to use `socket` as output stream and `write` to it sequentially. - ^.^.^.as-output send > as-output + as-output send > as-output # Send bytes through the socket. # Here `buffer` must be an object that can be dataized. @@ -392,13 +392,13 @@ code. > sent win32 "send" - * ^.sockfd buff buff.size 0 + * sockfd buff buff.size 0 if. > @ sent.eq -1 error sprintf "Failed to send message through the socket '%d', WSA error code: %d" - * ^.sockfd ^.^.last-error.code + * sockfd last-error.code sent # Receive bytes from the socket. @@ -408,13 +408,13 @@ called. > received win32 "recv" - * ^.sockfd size 0 + * sockfd size 0 if. > @ received.code.eq -1 error sprintf "Failed to receive data from the socket '%d', WSA error code: %d" - * ^.sockfd ^.^.last-error.code + * sockfd last-error.code received.output # Get last error. @@ -438,7 +438,7 @@ error sprintf "Couldn't close a win32 socket '%d', WSA error code: %d" - * sockfd ^.last-error.code + * sockfd last-error.code true # Safe win32 socket that ensures that socket is closed and Winsock resources are @@ -460,15 +460,15 @@ * started-up try if. - ^.sd.eq -1 + sd.eq -1 error sprintf "Couldn't create a win32 socket, WSA error code: %d" - * ^.last-error.code + * last-error.code try scope error ex > [ex] - ^.closed-socket ^.sd + closed-socket sd error ex > [ex] if. cleaned-up.eq win32.socket-error @@ -479,7 +479,7 @@ # Here `scope` must be an abstract object with one free attribute which will be # set to `scoped-socket` object and used as connector for socket messaging. [scope] > connect - ^.safe-socket > @ + safe-socket > @ [] >> ^.^ > sock code. > connected @@ -503,7 +503,7 @@ # this free attribute is set to abstract object which decorates `scoped-socket` and also # has attribute `accept` to accept other socket connections. [scope] > listen - ^.safe-socket > @ + safe-socket > @ [] >> ^.^ > sock code. > bound @@ -530,14 +530,13 @@ dataized scope [] >> - ^.sock.scoped-socket ^.sock.sd > @ + sock.scoped-socket sock.sd > @ # Accept incoming connection on socket # On success the client socket is returned, otherwise `error` is returned. # Client socket decorates `scoped-socket` object, so all the attributes like # `send`, `recv`, `as-input`, `as-output` are available. [scope] > accept - ^.^.sock > sock code. > client-sockfd win32 "accept" diff --git a/eo-runtime/src/main/eo/org/eolang/number.eo b/eo-runtime/src/main/eo/org/eolang/number.eo index d73f1e7298..43d8b38578 100644 --- a/eo-runtime/src/main/eo/org/eolang/number.eo +++ b/eo-runtime/src/main/eo/org/eolang/number.eo @@ -32,9 +32,9 @@ [as-bytes] > number as-bytes > @ $ > as-number - $.times -1 > neg - $.as-i64.as-i32 > as-i32 - $.as-i32.as-i16 > as-i16 + times -1 > neg + as-i64.as-i32 > as-i32 + as-i32.as-i16 > as-i16 as-bytes.eq nan.as-bytes > is-nan # Convert this `number` to `i64` object. @@ -46,12 +46,12 @@ # According to IEEE 754 float -0.0 and 0.0 are equal. [x] > eq x > x-as-bytes! - ^.as-bytes > self-as-bytes + as-bytes > self-as-bytes 0.as-bytes > pos-zero-as-bytes -0.as-bytes > neg-zero-as-bytes if. > @ or. - ^.is-nan + is-nan (number x-as-bytes).is-nan false or. @@ -70,7 +70,7 @@ [x] > lt x > value! 0.gt > @ - ^.minus + minus number value # Returns `true` if `$` <= `x`. @@ -79,8 +79,8 @@ [x] > lte x > value! or. > @ - ^.lt value - ^.eq value + lt value + eq value # Returns `true` if `$` > `x`. # Here `x` can be a `number` or any other object which @@ -93,8 +93,8 @@ [x] > gte x > value! or. > @ - ^.gt value - ^.eq value + gt value + eq value # Multiplication of `$` and `x`. # Here `x` can be a `number` or any other object which @@ -111,7 +111,7 @@ # can be converted to 8 `bytes` via `as-bytes` object. [x] > minus x > value! - ^.plus > @ + plus > @ (number value).neg # Quotient of the division of `$` by `x`. @@ -126,15 +126,14 @@ # Returns `true` if current number does not have a fractional component. [] > is-integer and. > @ - ^.is-finite - ^.eq ^.floor + is-finite + eq floor # Returns `true` if current number is finite. [] > is-finite and. > @ - ^.is-nan.not + is-nan.not not. or. - ^.eq positive-infinity - ^.eq negative-infinity - + eq positive-infinity + eq negative-infinity diff --git a/eo-runtime/src/main/eo/org/eolang/positive-infinity.eo b/eo-runtime/src/main/eo/org/eolang/positive-infinity.eo index 200aaf9a6b..b28f61e19b 100644 --- a/eo-runtime/src/main/eo/org/eolang/positive-infinity.eo +++ b/eo-runtime/src/main/eo/org/eolang/positive-infinity.eo @@ -26,6 +26,8 @@ +version 0.0.0 # Positive infinity. +# A special floating-point value representing an unbounded quantity greater than all real numbers. +# When dataized, it signifies an unbounded upper limit or an unreachable maximum value. [] > positive-infinity number 7F-F0-00-00-00-00-00-00 > @ $ > floor @@ -35,33 +37,33 @@ false > is-integer error "Can't convert positive infinity to i64" > as-i64 - # Tests that $ = x. + # Tests that the value $ is equal to x. [x] > eq eq. > @ ^.as-bytes x.as-bytes - # Tests that $ < x. + # Tests that the value $ less than x. false > [x] > lt - # Tests that $ <= x. - ^.eq x > [x] > lte + # Tests that the value $ less or equal than x. + eq x > [x] > lte - # Tests that $ > x. + # Tests that the value $ greater than x. [x] > gt x > value! not. > @ or. (number value).is-nan - ^.eq value + eq value - # Tests that $ >= x. + # Tests that the value $ greater or equal than x. [x] > gte x > value! not. > @ (number value).is-nan - # Multiplication of $ and x. + # Returns the result of the multiplication of $ and x. [x] > times x > value! number value > num @@ -75,7 +77,7 @@ ^ negative-infinity - # Sum of $ and x. + # Returns the result of the sum of $ and x. [x] > plus x > value! if. > @ @@ -85,7 +87,7 @@ nan ^ - # Difference between $ and x. + # Difference between the values of $ and x. [x] > minus x > value! if. > @ diff --git a/eo-runtime/src/main/eo/org/eolang/seq.eo b/eo-runtime/src/main/eo/org/eolang/seq.eo index 297dbf4c93..e28fdf7183 100644 --- a/eo-runtime/src/main/eo/org/eolang/seq.eo +++ b/eo-runtime/src/main/eo/org/eolang/seq.eo @@ -32,21 +32,22 @@ if. > @ steps.length.eq 0 true - loop 0 - steps.length.minus 1 > max-len! + if. + steps.length.eq 1 + steps.value + loop steps + steps.length.plus -1 > last-index! # Recursive steps dataization. # # Attention! The object is for internal usage only, please # don't use the object programmatically outside of `seq` object. - [index] > loop + [tup] > loop if. > @ and. - index.lt ^.max-len - or. - (dataized (steps.at index)).as-bool - true - ^.loop - index.plus 1 - steps.at index - + tup.length.gt 1 + loop tup.prev + tup.value + or. + (dataized tup.value).as-bool.eq -- + tup.length.eq last-index diff --git a/eo-runtime/src/main/eo/org/eolang/string.eo b/eo-runtime/src/main/eo/org/eolang/string.eo index c6f7b3d1ee..c10ad1df3c 100644 --- a/eo-runtime/src/main/eo/org/eolang/string.eo +++ b/eo-runtime/src/main/eo/org/eolang/string.eo @@ -33,7 +33,7 @@ # Calculates the length of the string. [] > length - ^.as-bytes.size > size + as-bytes.size > size 80- > pattern-one E0- > pattern-two F0- > pattern-three @@ -52,34 +52,34 @@ # `accum` increased by 1. [index char-size len] > increase-length if. > @ - (index.plus char-size).gt ^.size + (index.plus char-size).gt size error sprintf "Expected %d byte character at %d index, but there are not enough bytes for it: %x" - * char-size index ^.^.as-bytes - ^.rec-length + * char-size index as-bytes + rec-length index.plus char-size len.plus 1 # The object recursively calculates the length of current string considering how many bytes # the character on each iteration must consist of. [index accum] > rec-length - ^.^.as-bytes.slice index 1 > byte + as-bytes.slice index 1 > byte if. > @ - index.eq ^.size + index.eq size accum if. (byte.and pattern-one).eq result-one - ^.increase-length index 1 accum + increase-length index 1 accum if. (byte.and pattern-two).eq result-two - ^.increase-length index 2 accum + increase-length index 2 accum if. (byte.and pattern-three).eq result-three - ^.increase-length index 3 accum + increase-length index 3 accum if. (byte.and pattern-four).eq result-four - ^.increase-length index 4 accum + increase-length index 4 accum error sprintf "Unknown byte format (%x), can't recognize character" @@ -91,7 +91,7 @@ len > len-bytes! number start-bytes > num-start number len-bytes > num-len - ^.as-bytes.size > size + as-bytes.size > size num-start.plus num-len > end 80- > pattern-one E0- > pattern-two @@ -133,19 +133,19 @@ num-len.eq 0 "" string - ^.as-bytes.slice bts-start bts-length + as-bytes.slice bts-start bts-length # The object checks if `index` + provided `char-size` is not out of the string bounds. # If not - the new recursion circle is started with `index` is increased by `char-size` and # `accum` is increased by 1. [index char-size accum result cause] > increase if. > @ - (index.plus char-size).gt ^.size + (index.plus char-size).gt size error sprintf "Expected %d byte character at %d index, but there are not enough bytes for it: %x" - * char-size index ^.^.as-bytes - ^.rec-index + * char-size index as-bytes + rec-index index.plus char-size accum.plus 1 result @@ -158,25 +158,25 @@ # Also it checks how many bytes (B) must contain character on the current step and tries to # increase index by B. [index accum result cause] > rec-index - ^.^.as-bytes.slice index 1 > byte + as-bytes.slice index 1 > byte if. > @ accum.eq result index if. - index.eq ^.size + index.eq size error cause if. (byte.and pattern-one).eq result-one - ^.increase index 1 accum result cause + increase index 1 accum result cause if. (byte.and pattern-two).eq result-two - ^.increase index 2 accum result cause + increase index 2 accum result cause if. (byte.and pattern-three).eq result-three - ^.increase index 3 accum result cause + increase index 3 accum result cause if. (byte.and pattern-four).eq result-four - ^.increase index 4 accum result cause + increase index 4 accum result cause error sprintf "Unknown byte format (%x), can't recognize character" diff --git a/eo-runtime/src/main/eo/org/eolang/structs/bytes-as-array.eo b/eo-runtime/src/main/eo/org/eolang/structs/bytes-as-array.eo index 850741066d..0eb118dc62 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/bytes-as-array.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/bytes-as-array.eo @@ -29,15 +29,14 @@ # Here `bts` is `bytes` objects, the return value is `tuple` where # each element is one `byte`. [bts] > bytes-as-array - bts.size > bytes-size! - slice-byte > @ - * - 0 + bts > dataized-bts! + dataized-bts.size > bytes-size! + slice-byte * 0 > @ [tup index] > slice-byte if. > @ - index.lt ^.bytes-size - ^.slice-byte - tup.with (^.bts.slice index 1) - index.plus 1 + index.lt bytes-size + slice-byte + tup.with (bts.slice index 1) + (index.plus 1).as-number tup diff --git a/eo-runtime/src/main/eo/org/eolang/structs/hash-code-of.eo b/eo-runtime/src/main/eo/org/eolang/structs/hash-code-of.eo index f418f16e20..e438f7ea4b 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/hash-code-of.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/hash-code-of.eo @@ -38,13 +38,13 @@ [acc index] > rec-hash-code if. > @ - index.eq ^.size + index.eq size acc.as-number - ^.rec-hash-code + rec-hash-code plus. - ^.magic-number.times acc + magic-number.times acc as-i64. concat. 00-00-00-00-00-00-00 - ^.input-as-bytes.slice index 1 - index.plus 1 + input-as-bytes.slice index 1 + (index.plus 1).as-number diff --git a/eo-runtime/src/main/eo/org/eolang/structs/list.eo b/eo-runtime/src/main/eo/org/eolang/structs/list.eo index 1fa01dc331..7f3b939d7d 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/list.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/list.eo @@ -24,63 +24,60 @@ +home https://github.com/objectionary/eo +package org.eolang.structs +version 0.0.0 ++unlint broken-ref # List implements based operations on collections like reducing, mapping, filtering, etc. # Decorates and extends `tuple`. [origin] > list origin > @ - # Is it empty?. - 0.eq ^.origin.length > [] > is-empty + # A check to determine if an object contains no elements or data. + 0.eq origin.length > is-empty # Create a new list with this element added to the end of it. [x] > with list > @ - with. - ^.origin - x + origin.with x # Create a new list with an element inserted by the provided index. [index item] > withi concat. > @ with. - ^.head index + head index item - ^.tail - ^.origin.length.minus index + tail + origin.length.minus index # Reduce with index from "start" using the function "func". # Here "func" must be an abstract object with three free attributes. # The first one for the accumulator, the second one # for the element of the collection and the third one for the index. [start func] > reducedi - ^.origin.length > origin-len! if. > @ - 0.eq origin-len + is-empty start - rec-reduced start 0.as-bytes + rec-reducedi origin - [accum index] > rec-reduced - index.as-number > idx-as-number - 1.plus idx-as-number > next-index! + [tup] > rec-reducedi if. > @ - next-index.eq ^.origin-len - ^.func > accumulated - accum - ^.^.origin.at idx-as-number - idx-as-number - ^.rec-reduced - accumulated - next-index + tup.length.eq 1 + func + start + tup.value + 0 + func + rec-reducedi tup.prev + tup.value + tup.prev.length # Reduce from "start" using the function "func". # Here "func" must be an abstract object with two free attributes. # The first one for the accumulator, the second one for the element # of the collection. [start func] > reduced - ^.reducedi > @ + reducedi > @ start - ^.func accum item > [accum item idx] >> + func accum item > [accum item idx] >> # Map with index. Here "func" must be an abstract # object with two free attributes. The first @@ -88,19 +85,18 @@ # for the index. [func] > mappedi list > @ - ^.reducedi + reducedi * [accum item idx] >> - with. > @ - accum - ^.func item idx + accum.with > @ + func item idx # Map without index. Here "func" must be an abstract # object with one free attribute, for the element # of the collection. [func] > mapped - ^.mappedi > @ - ^.func item > [item idx] >> + mappedi > @ + func item > [item idx] >> # For each collection element dataize the object # Here "func" must be an abstract object with @@ -108,39 +104,39 @@ # collection and its index. # The result of `func` must be dataizable. [func] > eachi - ^.reducedi > @ + reducedi > @ true [acc item index] >> seq * > @ acc - ^.func item index + func item index # For each collection element dataize the object # Here "func" must be an abstract object with # one free attribute, the element of the collection. [func] > each - ^.eachi > @ - ^.func item > [item index] >> + eachi > @ + func item > [item index] >> # Create a new list without the i-th element. [i] > withouti list > @ - ^.reducedi + reducedi * [accum item idx] >> if. > @ - ^.i.eq idx + i.eq idx accum accum.with item # Create a new list without the `element` which is `.eq` to given one. [element] > without list > @ - ^.reduced + reduced * [accum item] >> if. > @ - ^.element.eq item + element.eq item accum accum.with item @@ -149,48 +145,56 @@ [other] > eq and. > @ eq. - ^.origin.length + origin.length other.length - ^.reducedi + rec-eq origin other + + [first second] > rec-eq + if. > @ + first.length.eq 0 true - [accum item idx] >> - and. > @ - accum - eq. - item - ^.other.at idx + and. + first.value.eq second.value + rec-eq first.prev second.prev # Concatenates current list with given one. [passed] > concat - reduced. > @ - list - passed + (list passed).reducedi > @ ^ - accum.with item > [accum item] + accum.with item > [accum item index] # Returns index of the first particular item in list. # If the list has no this item, index-of returns -1. [wanted] > index-of - ^.reducedi > @ - -1 - [accum item index] >> - if. > @ - and. - -1.eq accum - item.eq ^.wanted - index - accum + number > @ + rec-index-of origin + + [tup] > rec-index-of + rec-index-of tup.prev > next! + if. > @ + tup.length.eq 0 + -1 + if. + next.eq -1 + if. + tup.value.eq wanted + tup.prev.length + -1 + next # Returns index of the last particular item in list. # If the list has no this item, returns -1. [wanted] > last-index-of - ^.reducedi > @ - -1 - [accum item index] >> - if. > @ - item.eq ^.wanted - index - accum + rec-last-index-of origin > @ + + [tup] > rec-last-index-of + if. > @ + tup.length.eq 0 + -1 + if. + tup.value.eq wanted + tup.prev.length + rec-last-index-of tup.prev # Returns `true` if the list contains `element`. # Otherwise, `false`. @@ -198,7 +202,7 @@ not. > @ eq. -1 - ^.index-of element + index-of element # Returns a new list sorted via `.lt` method. # @todo #3251:30min The object does not work. After moving `list` object @@ -214,23 +218,18 @@ # for the index. The result of dataization # the `func` should be boolean, that is `true` or `false`. [func] > filteredi - ^.origin.length > origin-length! list > @ - rec-filtered 0.as-bytes * + rec-filteredi origin - [idx-as-bytes accum] > rec-filtered - ^.^.origin > original - idx-as-bytes.as-number > index - ^.^.origin.at index > item + [tup] > rec-filteredi + rec-filteredi tup.prev > next if. > @ - idx-as-bytes.eq ^.origin-length - accum - ^.rec-filtered - (1.plus index).as-bytes - if. - ^.func item index - accum.with item - accum + tup.length.eq 0 + * + if. + func tup.value tup.prev.length + next.with tup.value + next # Filter list without index with the function `func`. # Here `func` must be an abstract object @@ -238,46 +237,42 @@ # The result of dataization the `func` # should be boolean, that is `true` or `false`. [func] > filtered - ^.filteredi > @ - ^.func item > [item index] >> + filteredi > @ + func item > [item index] >> # Get the first `index` elements from the start of the list. [index] > head index > idx! - switch > @ - * - * - 0.eq idx - list * - * - 0.gt idx - ^.tail index.as-number.neg - * - ^.origin.length.lte idx + if. > @ + idx.eq 0 + list * + if. + 0.gt idx + tail (number idx).neg + if. + (number idx).gte origin.length ^ - * - true list - ^.reducedi - * - [accum item index] >> - if. > @ - index.gte ^.idx - accum - accum.with item + rec-head origin + + [tup] > rec-head + if. > @ + tup.length.eq idx + tup + rec-head tup.prev # Get the last `index` elements from the end of the list. [index] > tail index > idx! - ^.origin.length.minus idx.as-number > start! + origin.length.minus idx > start! if. > @ 0.gt start ^ list - ^.reducedi + reducedi * [accum item idx] >> if. > @ - idx.gte ^.start + idx.gte start accum.with item accum diff --git a/eo-runtime/src/main/eo/org/eolang/structs/map.eo b/eo-runtime/src/main/eo/org/eolang/structs/map.eo index 10600fbe0c..65ea47f892 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/map.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/map.eo @@ -27,41 +27,42 @@ +home https://github.com/objectionary/eo +package org.eolang.structs +version 0.0.0 ++unlint broken-ref # Hash-map. -# Here `pairs` must be a `tuple` of `tuple`s where each sub-tuple consists of 2 -# elements - key and value. -# Key must be a dataizable object, value may be any object. +# Here `pairs` must be a `tuple` of `map.entry` object. +# The `map.entry.key` must be a dataizable object, `map.entry.value` may be any object. [pairs] > map - initialized. > @ + this. > @ [] >> - ^.pairs.length > pairs-size! - ^.initialized > @ - if. - pairs-size.eq 0 - * - rec-rebuild + initialized > @ + as-tuple. + if. + pairs.length.eq 0 * - 0 - list * + entries. + rec-rebuild + pairs - [accum index hashes] > rec-rebuild - ^.^.pairs.at index > entry - hash-code-of entry.key > hash! + [entries hashes] > couple + $ > this + + [tup] > rec-rebuild + hash-code-of tup.value.key > hash! + (rec-rebuild tup.prev).this > prev if. > @ - ^.pairs-size.eq index - accum - ^.rec-rebuild - if. - hashes.contains hash - accum - accum.with + tup.length.eq 0 + couple * (list *) + if. + prev.hashes.contains hash + prev + couple + prev.entries.with [] >> - ^.entry.key > key - ^.entry.value > value + tup.value.key > key + tup.value.value > value ^.hash > hash - index.plus 1 - hashes.with hash + prev.hashes.with hash # Hash map entry. # Here 'key' is an object which is used to find `value` is hash map. @@ -72,26 +73,22 @@ # Initialized hash map with rebuilt entries. [entries] > initialized - $ > initialized + $ > this entries.length > size - # Returns `list` of all keys in hash map. # Keys order is not guaranteed. - [] > keys - mapped. > @ - list ^.entries - entry.key > [entry] - + mapped. > keys + list entries + entry.key > [entry] # Returns `list` of all values in hash map. # Values order is not guaranteed. - [] > values - mapped. > @ - list ^.entries - entry.value > [entry] + mapped. > values + list entries + entry.value > [entry] # Returns `true` if hash map has object by given `key`. # Here `key` must be dataizable. - (^.found key).exists > [key] > has + (found key).exists > [key] > has # Tries to find object in hash map by given `key`. # Here `key` must be dataizable. @@ -114,54 +111,57 @@ [key] > found hash-code-of key > hash! if. > @ - ^.size.eq 0 + size.eq 0 not-found - rec-key-search - not-found - 0 + rec-key-search entries - [found index] > rec-key-search - ^.^.entries.at index > entry + [tup] > rec-key-search + (rec-key-search tup.prev).this > prev if. > @ - or. - found.exists - ^.^.size.eq index - found - ^.rec-key-search + tup.length.eq 0 + not-found + if. + prev.exists + prev if. - ^.hash.eq entry.hash - [] (true > exists) (^.entry.value > get) >> - found - index.plus 1 + tup.value.hash.eq hash + [] >> + $ > this + true > exists + tup.value.value > get + not-found [] > not-found + $ > this false > exists error > get sprintf "Object by hash code %d from given key does not exists" - * ^.hash + * hash # Returns the new `map` with added object # Replaces if there was one before. [key value] > with hash-code-of key > hash! - map.initialized > @ - with. - origin. - filtered. - list ^.entries - (^.hash.eq entry.hash).not > [entry] >> - [] >> - ^.key > key - ^.value > value - ^.hash > hash + this. > @ + map.initialized + with. + origin. + filtered. + list entries + (hash.eq entry.hash).not > [entry] >> + [] >> + ^.key > key + ^.value > value + ^.hash > hash # Returns a new `map`, without element with the given `key` # Returns the `map` itself, if there was no item with this `key`. [key] > without hash-code-of key > hash! - map.initialized > @ - origin. - filtered. - list ^.entries - (^.hash.eq entry.hash).not > [entry] >> + this. > @ + map.initialized + origin. + filtered. + list entries + (hash.eq entry.hash).not > [entry] >> diff --git a/eo-runtime/src/main/eo/org/eolang/structs/range-of-ints.eo b/eo-runtime/src/main/eo/org/eolang/structs/range-of-ints.eo index 49f4381e21..27f10a3851 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/range-of-ints.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/range-of-ints.eo @@ -25,6 +25,7 @@ +home https://github.com/objectionary/eo +package org.eolang.structs +version 0.0.0 ++unlint broken-ref # Range of integers from `start` to `end` (soft border) with step = 1. # Here `start` and `end` must be `int`s. If they're not - an error will diff --git a/eo-runtime/src/main/eo/org/eolang/structs/set.eo b/eo-runtime/src/main/eo/org/eolang/structs/set.eo index da9b6dc813..843646715d 100644 --- a/eo-runtime/src/main/eo/org/eolang/structs/set.eo +++ b/eo-runtime/src/main/eo/org/eolang/structs/set.eo @@ -29,7 +29,7 @@ # Set - is an unordered `list` of unique objects. [lst] > set - initialized. > @ + this. > @ initialized map list @@ -39,23 +39,24 @@ .origin # Initialized set with rebuilt unique sequence. - [map] > initialized - $ > initialized - $.map.keys > @ - $.map.size > size + [mp] > initialized + $ > this + mp.keys > @ + mp.size > size # Append new `item` to set. It must be possible to get # hash code of `item` so `item` must be dataizable. [item] > with - set.initialized > @ - ^.map.with item true + this. > @ + set.initialized + mp.with item true # Remove `item` from `set`. If `item` is not present, # the set wont be changed. [item] > without - set.initialized > @ - ^.map.without item + this. > @ + set.initialized + mp.without item # Check if given `item` exists in set. - [item] > has - ^.map.has item > @ + mp.has item > [item] > has diff --git a/eo-runtime/src/main/eo/org/eolang/switch.eo b/eo-runtime/src/main/eo/org/eolang/switch.eo index 9f112e7c44..cd6fd7a4bc 100644 --- a/eo-runtime/src/main/eo/org/eolang/switch.eo +++ b/eo-runtime/src/main/eo/org/eolang/switch.eo @@ -53,12 +53,12 @@ # If case key is true, return case value. # Otherwise take next case. [index] > case-at - ^.cases.at index > case + cases.at index > case if. > @ - index.eq ^.len + index.eq len true if. case.at 0 case.at 1 - ^.case-at + case-at index.plus 1 diff --git a/eo-runtime/src/main/eo/org/eolang/sys/os.eo b/eo-runtime/src/main/eo/org/eolang/sys/os.eo index 149fc89def..08301bffdf 100644 --- a/eo-runtime/src/main/eo/org/eolang/sys/os.eo +++ b/eo-runtime/src/main/eo/org/eolang/sys/os.eo @@ -33,7 +33,7 @@ name > @ [] > is-windows - ^.name > os-name! + name > os-name! and. > @ os-name.size.gt 6 (os-name.slice 0 7).eq "Windows" diff --git a/eo-runtime/src/main/eo/org/eolang/sys/posix.eo b/eo-runtime/src/main/eo/org/eolang/sys/posix.eo index 0f89799645..cb90faff51 100644 --- a/eo-runtime/src/main/eo/org/eolang/sys/posix.eo +++ b/eo-runtime/src/main/eo/org/eolang/sys/posix.eo @@ -46,7 +46,6 @@ # Timeval structure for "gettimeofday" syscall. # Here `tv-sec` is seconds since Jan 1, 1970, and `tv-usec` - microseconds. [tv-sec tv-usec] > timeval - $ > self # The posix `sockaddr_in` structure. [sin-family sin-port sin-addr] > sockaddr-in diff --git a/eo-runtime/src/main/eo/org/eolang/sys/win32.eo b/eo-runtime/src/main/eo/org/eolang/sys/win32.eo index 7916134d38..2adefe1b11 100644 --- a/eo-runtime/src/main/eo/org/eolang/sys/win32.eo +++ b/eo-runtime/src/main/eo/org/eolang/sys/win32.eo @@ -52,7 +52,6 @@ # Structure for "GetSystemTime" function call. [year month day day-of-week hour minute second milliseconds] > system-time - $ > self # The win32 `sockaddr_in` structure. [sin-family sin-port sin-addr] > sockaddr-in diff --git a/eo-runtime/src/main/eo/org/eolang/true.eo b/eo-runtime/src/main/eo/org/eolang/true.eo index 58f6741631..f220357e65 100644 --- a/eo-runtime/src/main/eo/org/eolang/true.eo +++ b/eo-runtime/src/main/eo/org/eolang/true.eo @@ -35,7 +35,9 @@ left > [left right] > if # And. + # A logical operation that returns True only if all given conditions are true. 01-.eq x > [x] > and # Or. + # A logical operation that returns True if at least one of the given conditions is true. ^ > [x] > or diff --git a/eo-runtime/src/main/eo/org/eolang/tuple.eo b/eo-runtime/src/main/eo/org/eolang/tuple.eo index cd6ef710a6..25a08454a4 100644 --- a/eo-runtime/src/main/eo/org/eolang/tuple.eo +++ b/eo-runtime/src/main/eo/org/eolang/tuple.eo @@ -26,44 +26,54 @@ +version 0.0.0 # Tuple. -[head tail] > tuple +# An ordered, immutable collection of elements. +[prev value length] > tuple + $ > as-tuple + # Empty tuple. + # A tuple with no elements. When dataized, it represents an immutable, empty collection. [] > empty + $ > empty + $ > as-tuple 0 > length + error "Can't get prev from the empty tuple" > prev + error "Can't get value from the empty tuple" > value # Take one element from the tuple, at the given position. error "Can't get an object from the empty tuple" > [i] > at # Create a new tuple with this element added to the end of it. - tuple ^ x > [x] > with - - # Obtain the length of the tuple. - [] > length - head.length.plus 1 > len! - number len > @ + [x] > with + as-tuple. > @ + tuple + ^ + x + (length.plus 1).as-number # Take one element from the tuple, at the given position. [i] > at - ^.length > len i > idx! if. > index! 0.gt idx - len.plus idx + length.plus idx idx if. > @ or. 0.gt index - len.lte index + length.lte index error "Given index is out of tuple bounds" - at-fast ^ len + at-fast ^ - [tup len] > at-fast + [tup] > at-fast if. > @ - (len.plus -1).gt index - ^.at-fast - tup.head - len.plus -1 - tup.tail + (tup.length.plus -1).eq index + tup.value + at-fast tup.prev # Create a new tuple with this element added to the end of it. - tuple ^ x > [x] > with + [x] > with + as-tuple. > @ + tuple + ^ + x + (length.plus 1).as-number diff --git a/eo-runtime/src/main/eo/org/eolang/txt/regex.eo b/eo-runtime/src/main/eo/org/eolang/txt/regex.eo index c0133f221c..516d3fe1b3 100644 --- a/eo-runtime/src/main/eo/org/eolang/txt/regex.eo +++ b/eo-runtime/src/main/eo/org/eolang/txt/regex.eo @@ -62,7 +62,7 @@ [serialized] > pattern # Returns `true` of given `txt` matches against # the provided regular expression pattern. - (^.match txt).next.exists > [txt] > matches + (match txt).next.exists > [txt] > matches # Creates a `matcher` that will match the given input against the pattern. [txt] > match @@ -98,7 +98,7 @@ if. > next exists matched. - ^.matched-from-index + matched-from-index position.plus 1 to error "Matched block does not exist, can't get next" @@ -109,12 +109,12 @@ # Returns the string subsequence captured by the group # by `index` during the `match` operation. - ^.groups.at index > [index] > group + groups.at index > [index] > group # Block which does not match the provided pattern. # Decorates `matched` block with corresponding `error`s. [position] > not-matched - ^.matched > @ + matched > @ position -1 error "Matched block does not exist, can't get 'from' position" diff --git a/eo-runtime/src/main/eo/org/eolang/txt/text.eo b/eo-runtime/src/main/eo/org/eolang/txt/text.eo index cd11c0652a..1c6d9dc1e5 100644 --- a/eo-runtime/src/main/eo/org/eolang/txt/text.eo +++ b/eo-runtime/src/main/eo/org/eolang/txt/text.eo @@ -29,8 +29,14 @@ +home https://github.com/objectionary/eo +package org.eolang.txt +version 0.0.0 ++unlint broken-ref # Text. +# A sequence of characters representing words, sentences, or data. +# @todo #3481:30min Remove all +unlit broken-ref from EO source code. +# These suppressions were added in order to be compile EO when @ref attribute +# from XMIR is removed, by it's checked by LintMojo. We need to remove these +# suppressions when `lints` repository is fixed and new version is used in EO. [origin] > text origin > @ # Check that all signs in string are numbers or letters. @@ -47,95 +53,98 @@ # `len` must be an integer which shows how much symbols should be sliced. [start len] > slice text > @ - ^.origin.slice start len + origin.slice start len # Returns `text` trimmed from left side. [] > trimmed-left - ^.origin.length > len! + origin > bts! + bts.size > len! first-non-space-index 0 > idx! + 20- > space if. > @ 0.eq len ^ - ^.slice - idx - (number len).minus (number idx) + text + string + bts.slice + idx + (number len).minus idx [index] > first-non-space-index - ^.^.origin.slice index 1 > char! + bts.slice index 1 > char! if. > @ - ^.len.eq index + len.eq index index if. - " ".eq char - ^.first-non-space-index - index.plus 1 + char.eq space + first-non-space-index (index.plus 1).as-number index # Returns `text` trimmed from right side. [] > trimmed-right - ^.origin.length > len! + origin > bts! + bts.size > len! + 20- > space if. > @ 0.eq len ^ - ^.slice - 0 - first-non-space-index - (number len).plus -1 + text + string + bts.slice + 0 + first-non-space-index + (number len).plus -1 [index] > first-non-space-index - ^.^.origin.slice index 1 > char! + bts.slice index 1 > char! if. > @ -1.eq index 0 if. - " ".eq char - ^.first-non-space-index - index.plus -1 + char.eq space + first-non-space-index (index.plus -1).as-number index.plus 1 # Returns `text` trimmed from both sides. [] > trimmed if. > @ - 0.eq ^.length + 0.eq origin.as-bytes.size ^ - trimmed-right. - trimmed-left. - ^ + trimmed-left.trimmed-right # Joins `items`, which is a `tuple` of strings, using current `string` # as a delimiter. [items] > joined - ^.origin > delimiter! - items.at 0 > first - items.length > len! - if. > not-empty! - 1.eq len - first - concat. - first.as-bytes - with-delimiter "".as-bytes 1 + origin > delimiter! + if. > joined-bts! + items.length.eq 0 + -- + with-delimiter items.value items.prev text > @ - if. - 0.eq len - "" - string not-empty + string joined-bts - [acc index] > with-delimiter + [acc tup] > with-delimiter if. > @ - ^.len.eq index + tup.length.eq 0 acc - ^.with-delimiter - acc.concat - ^.delimiter.concat - ^.items.at index - index.plus 1 + with-delimiter + concat. + concat. + dataized tup.value + delimiter + acc + tup.prev # Returns `text` repeated `times` times. # If `times` < 0 - an error is returned. # If `times` == 0 - an original text is returned. [times] > repeated - ^.origin.as-bytes > bts! + origin > bts! times > amount! + if. > repeated-bytes! + 0.eq amount + -- + rec-repeated bts 1 if. > @ 0.gt amount error @@ -143,105 +152,141 @@ "Can't repeat text %d times" * amount text - if. - 0.eq amount - "" - string - rec-repeated bts 1 + string repeated-bytes [accum index] > rec-repeated if. > @ - ^.amount.eq index + amount.eq index accum - ^.rec-repeated - accum.concat ^.bts - index.plus 1 + rec-repeated + accum.concat bts + (index.plus 1).as-number # Checks if current `text` contains given `substring`. [substring] > contains - not. > @ - eq. - -1 - ^.index-of substring + origin > origin-bts! + substring > substring-bts! + origin-bts.size > origin-size! + substring-bts.size > substring-size! + (number origin-size).minus substring-size > end! + and. > @ + (number origin-size).gte substring-size + or. + and. + origin-size.eq substring-size + origin-bts.eq substring-bts + rec-contains 0 + + [idx] > rec-contains + eq. > includes + origin-bts.slice idx substring-size + substring-bts + if. > @ + end.eq idx + includes + or. + includes + rec-contains (idx.plus 1).as-number # Checks that current `text` ends with given `substring`. [substring] > ends-with - substring > substr! - eq. > @ - ^.index-of substr - ^.length.minus substr.size + origin > origin-bts! + substring > substring-bts! + origin-bts.size > origin-size! + substring-bts.size > substring-size! + and. > @ + (number substring-size).lte origin-size + eq. + origin-bts.slice + (number origin-size).minus substring-size + substring-size + substring-bts # Checks that current `text` starts with given `substring`. [substring] > starts-with - eq. > @ - 0 - ^.index-of substring + origin > origin-bts! + substring > substring-bts! + origin-bts.size > origin-size! + substring-bts.size > substring-size! + and. > @ + (number substring-size).lte origin-size + (origin-bts.slice 0 substring-size).eq substring-bts # Returns index of `substring` in current `text`. # If no `substring` was found, it returns -1. [substring] > index-of - (string ^.origin.as-bytes).length > self-len! - string > substr - substring > substr-as-bytes! - substr.length > sub-len! - (number self-len).minus (number sub-len) > end! + origin > origin-bts! + substring > substring-bts! + origin-bts.size > origin-size! + substring-bts.size > substring-size! + (number origin-size).minus substring-size > end! + rec-index-of 0 > found! if. > @ or. - (number sub-len).gt self-len - and. - sub-len.eq self-len - (substr.eq ^.origin).not + or. + (number substring-size).gt origin-size + and. + substring-size.eq origin-size + (substring-bts.eq origin-bts).not + found.eq -1 -1 - rec-index-of-substr 0 + length. + string + origin-bts.slice 0 found - [idx] > rec-index-of-substr + [idx] > rec-index-of + eq. > includes + origin-bts.slice idx substring-size + substring-bts if. > @ - ^.end.eq idx + end.eq idx if. - eq. > contains - ^.substr - ^.^.slice idx ^.sub-len + includes idx -1 if. - contains + includes idx - ^.rec-index-of-substr - idx.plus 1 + rec-index-of (idx.plus 1).as-number # Returns last index of `substring` in current `text`. # If no element was found, it returns -1. [substring] > last-index-of - (string ^.origin.as-bytes).length > self-len! - string > substr - substring > substr-as-bytes! - substr.length > sub-len! + origin > origin-bts! + substring > substring-bts! + origin-bts.size > origin-size! + substring-bts.size > substring-size! + rec-index-of > found! + (number origin-size).minus substring-size if. > @ or. - (number sub-len).gt self-len - and. - sub-len.eq self-len - (substr.eq ^.origin).not + or. + (number substring-size).gt origin-size + and. + substring-size.eq origin-size + (substring-bts.eq origin-bts).not + found.eq -1 -1 - rec-index-of-substr - (number self-len).minus (number sub-len) + length. + string + origin-bts.slice 0 found - [idx] > rec-index-of-substr + [idx] > rec-index-of + eq. > includes + origin-bts.slice idx substring-size + substring-bts if. > @ 0.eq idx if. - eq. > contains - ^.substr - ^.^.slice idx ^.sub-len + includes idx -1 if. - contains + includes idx - ^.rec-index-of-substr - idx.plus -1 + rec-index-of (idx.plus -1).as-number - # Returns `text` in upper case. + # Returns the `text` in upper case. [] > up-cased ascii "z" > ascii-z! ascii "a" > ascii-a! @@ -253,19 +298,19 @@ reduced. list bytes-as-array - ^.origin.as-bytes + origin.as-bytes -- [accum byte] >> - ^.ascii byte > ascii-bte + ascii byte > ascii-bte accum.concat > @ if. and. - ascii-bte.lte ^.ascii-z - ascii-bte.gte ^.ascii-a + ascii-bte.lte ascii-z + ascii-bte.gte ascii-a slice. as-bytes. as-i64. - ascii-bte.minus ^.distance + ascii-bte.minus distance 7 1 byte @@ -277,28 +322,28 @@ 00-00-00-00-00-00-00 char.as-bytes - # Returns `text` in lower case. + # Returns the `text` in lower case. [] > low-cased - ^.up-cased.ascii "Z" > ascii-z - ^.up-cased.ascii "A" > ascii-a + up-cased.ascii "Z" > ascii-z + up-cased.ascii "A" > ascii-a text > @ string reduced. list bytes-as-array - ^.origin.as-bytes + origin.as-bytes -- [accum byte] >> - ^.^.up-cased.ascii byte > ascii-bte + up-cased.ascii byte > ascii-bte accum.concat > @ if. and. - ascii-bte.lte ^.ascii-z - ascii-bte.gte ^.ascii-a + ascii-bte.lte ascii-z + ascii-bte.gte ascii-a slice. as-bytes. as-i64. - ascii-bte.plus ^.^.up-cased.distance + ascii-bte.plus up-cased.distance 7 1 byte @@ -320,14 +365,14 @@ sprintf "Given index %d is out of text bounds" * index - ^.slice index 1 + slice index 1 # Returns `text` where all regex target changed to replacement. # Here `target` must be a `org.eolang.txt.regex` object. # The `replacement` here is a `string` that would be pasted instead of # matched text in original one. [target replacement] > replaced - ^.origin > self-as-bytes! + origin > self-as-bytes! string self-as-bytes > reinit (target.match reinit).next > matched if. > @ @@ -339,37 +384,37 @@ [block accum start] > rec-replaced if. > @ block.exists - ^.rec-replaced + rec-replaced block.next concat. concat. accum - ^.reinit.slice + reinit.slice start block.from.minus start - ^.replacement + replacement block.to string accum.concat - ^.reinit.slice + reinit.slice start - ^.reinit.length.minus start + reinit.length.minus start # Returns the original `text` as `number`. [] > as-number - sscanf "%f" ^.origin > scanned + (sscanf "%f" origin).as-tuple > scanned if. > @ scanned.length.eq 0 error sprintf "Can't convert text %s to number" - * ^.origin - scanned.tail + * origin + scanned.value # Returns a `tuple` of `strings`, separated by a given `delimiter`. [delimiter] > split delimiter > delim! - ^.origin.as-bytes > self-as-bytes + origin > self-as-bytes! self-as-bytes.size > len! if. > @ len.eq 0 @@ -378,27 +423,26 @@ [accum start current] > rec-split if. > @ - ^.len.eq current + len.eq current accum.with > with-substr string - ^.self-as-bytes.slice + self-as-bytes.slice start current.minus start if. - eq. - ^.delim - ^.self-as-bytes.slice current 1 - ^.rec-split + delim.eq + self-as-bytes.slice current 1 + rec-split with-substr - current.plus 1 - current.plus 1 - ^.rec-split + (current.plus 1).as-number + (current.plus 1).as-number + rec-split accum start - current.plus 1 + (current.plus 1).as-number # Returns concatenation of all `other` strings. - # Here `other` must be a `tuple` of `strings`. + # Here `others` must be a `tuple` of `strings`. [others] > chained if. > @ 0.eq others.length @@ -407,5 +451,5 @@ string reduced. list others - ^.origin.as-bytes + origin.as-bytes accum.concat str.as-bytes > [accum str] diff --git a/eo-runtime/src/main/eo/org/eolang/while.eo b/eo-runtime/src/main/eo/org/eolang/while.eo index a5d4b670d5..79f38d3806 100644 --- a/eo-runtime/src/main/eo/org/eolang/while.eo +++ b/eo-runtime/src/main/eo/org/eolang/while.eo @@ -65,5 +65,5 @@ (condition (index.plus 1)).as-bool seq * current - ^.loop (index.plus 1) + loop (index.plus 1) current diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOor.java b/eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOor.java index 63a3cda6a8..6771502918 100644 --- a/eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOor.java +++ b/eo-runtime/src/main/java/EOorg/EOeolang/EObytes$EOor.java @@ -63,4 +63,3 @@ public Phi lambda() { ); } } - diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOtimes.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOtimes.java index 9bcf97165e..fca0a43c41 100644 --- a/eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOtimes.java +++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOnumber$EOtimes.java @@ -57,9 +57,13 @@ public final class EOnumber$EOtimes extends PhDefault implements Atom { @Override public Phi lambda() { - final Double left = new Dataized(this.take(Attr.RHO)).asNumber(); + final Double left = Expect.at(this, Attr.RHO) + .that(phi -> new Dataized(phi).asNumber()) + .otherwise("must be a number") + .it(); final Double right = Expect.at(this, "x") .that(phi -> new Dataized(phi).asNumber()) + .otherwise("must be a number") .it(); return new Data.ToPhi(left * right); } diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Posix/GettimeofdaySyscall.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Posix/GettimeofdaySyscall.java index 972f585077..d139fbebe1 100644 --- a/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Posix/GettimeofdaySyscall.java +++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Posix/GettimeofdaySyscall.java @@ -58,7 +58,7 @@ public Phi make(final Phi... params) { final Phi result = this.posix.take("return").copy(); final GettimeofdaySyscall.Timeval timeval = new GettimeofdaySyscall.Timeval(); result.put(0, new Data.ToPhi(CStdLib.INSTANCE.gettimeofday(timeval, null))); - final Phi struct = params[0].take("self"); + final Phi struct = this.posix.take("timeval"); struct.put(0, new Data.ToPhi(timeval.sec)); struct.put(1, new Data.ToPhi(timeval.usec)); result.put(1, struct); diff --git a/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Win32/GetSystemTimeFuncCall.java b/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Win32/GetSystemTimeFuncCall.java index d4c4e12d33..bd2fd67de7 100644 --- a/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Win32/GetSystemTimeFuncCall.java +++ b/eo-runtime/src/main/java/EOorg/EOeolang/EOsys/Win32/GetSystemTimeFuncCall.java @@ -60,7 +60,7 @@ public Phi make(final Phi... params) { final GetSystemTimeFuncCall.SystemTime time = new GetSystemTimeFuncCall.SystemTime(); Kernel32.INSTANCE.GetSystemTime(time); result.put(0, new Data.ToPhi(true)); - final Phi struct = params[0].take("self"); + final Phi struct = this.win.take("system-time"); struct.put(0, new Data.ToPhi(time.year)); struct.put(1, new Data.ToPhi(time.month)); struct.put(2, new Data.ToPhi(time.day)); diff --git a/eo-runtime/src/main/java/org/eolang/Action.java b/eo-runtime/src/main/java/org/eolang/Action.java deleted file mode 100644 index 518fefc39f..0000000000 --- a/eo-runtime/src/main/java/org/eolang/Action.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -/** - * The action. - * @param The type - * @since 0.41.0 - */ -public interface Action { - - /** - * Run it. - * @return The value - */ - T act(); -} diff --git a/eo-runtime/src/main/java/org/eolang/AtComposite.java b/eo-runtime/src/main/java/org/eolang/AtComposite.java index 9ef64951af..12f1d4237e 100644 --- a/eo-runtime/src/main/java/org/eolang/AtComposite.java +++ b/eo-runtime/src/main/java/org/eolang/AtComposite.java @@ -65,7 +65,7 @@ public Phi get() { } @Override - public boolean put(final Phi phi) { + public void put(final Phi phi) { throw new ExReadOnly( "Can't overwrite lambda expression" ); diff --git a/eo-runtime/src/main/java/org/eolang/AtLogged.java b/eo-runtime/src/main/java/org/eolang/AtLogged.java index 4d0773347c..5e878b3a91 100644 --- a/eo-runtime/src/main/java/org/eolang/AtLogged.java +++ b/eo-runtime/src/main/java/org/eolang/AtLogged.java @@ -87,10 +87,9 @@ public Phi get() { } @Override - public boolean put(final Phi src) { + public void put(final Phi src) { this.log.info(String.format(" %s.put()...\n", this.owner)); - final boolean ret = this.origin.put(src); + this.origin.put(src); this.log.info(String.format(" %s.put()!\n", this.owner)); - return ret; } } diff --git a/eo-runtime/src/main/java/org/eolang/AtOnce.java b/eo-runtime/src/main/java/org/eolang/AtOnce.java index fdea6373dd..bc19bdc183 100644 --- a/eo-runtime/src/main/java/org/eolang/AtOnce.java +++ b/eo-runtime/src/main/java/org/eolang/AtOnce.java @@ -70,7 +70,7 @@ public Phi get() { } @Override - public boolean put(final Phi phi) { + public void put(final Phi phi) { throw new ExReadOnly( String.format( "Can't overwrite the \"%s\" attribute", @@ -78,5 +78,4 @@ public boolean put(final Phi phi) { ) ); } - } diff --git a/eo-runtime/src/main/java/org/eolang/AtRho.java b/eo-runtime/src/main/java/org/eolang/AtRho.java index 8a7002a0ab..89a99de2ae 100644 --- a/eo-runtime/src/main/java/org/eolang/AtRho.java +++ b/eo-runtime/src/main/java/org/eolang/AtRho.java @@ -70,14 +70,9 @@ public Phi get() { } @Override - public boolean put(final Phi phi) { - final boolean ret; + public void put(final Phi phi) { if (this.rho.get() == null) { this.rho.set(phi); - ret = true; - } else { - ret = false; } - return ret; } } diff --git a/eo-runtime/src/main/java/org/eolang/AtSetRho.java b/eo-runtime/src/main/java/org/eolang/AtSetRho.java deleted file mode 100644 index 6ff241e11e..0000000000 --- a/eo-runtime/src/main/java/org/eolang/AtSetRho.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -/** - * The attribute tries to copy object and set \rho to it. - * - *

If the name of the attribute is {@link Attr#RHO} - just object is returned.

- * - * @since 0.36.0 - */ -final class AtSetRho extends AtEnvelope { - /** - * Ctor. - * @param attr Origin attribute - * @param rho Rho that will be set - * @param name Name of the attribute - */ - AtSetRho(final Attr attr, final Phi rho, final String name) { - super( - new AtGetOnly( - () -> { - Phi ret = attr.get(); - if (!name.equals(Attr.RHO)) { - final Phi copy = ret.copy(); - if (copy.put(Attr.RHO, rho)) { - ret = copy; - } - } - return ret; - } - ) - ); - } -} diff --git a/eo-runtime/src/main/java/org/eolang/AtVoid.java b/eo-runtime/src/main/java/org/eolang/AtVoid.java index b6b99d98f1..2a1ec38c25 100644 --- a/eo-runtime/src/main/java/org/eolang/AtVoid.java +++ b/eo-runtime/src/main/java/org/eolang/AtVoid.java @@ -89,7 +89,7 @@ public Phi get() { } @Override - public boolean put(final Phi phi) { + public void put(final Phi phi) { if (this.object.get() == null) { this.object.set(phi); } else { @@ -100,7 +100,5 @@ public boolean put(final Phi phi) { ) ); } - return true; } - } diff --git a/eo-runtime/src/main/java/org/eolang/AtGetOnly.java b/eo-runtime/src/main/java/org/eolang/AtWithRho.java similarity index 66% rename from eo-runtime/src/main/java/org/eolang/AtGetOnly.java rename to eo-runtime/src/main/java/org/eolang/AtWithRho.java index deb37655fc..bb25fffa51 100644 --- a/eo-runtime/src/main/java/org/eolang/AtGetOnly.java +++ b/eo-runtime/src/main/java/org/eolang/AtWithRho.java @@ -24,44 +24,51 @@ package org.eolang; -import java.util.function.Supplier; - /** - * Attribute that only gets objects. - * + * The attribute that tries to copy object and set \rho to it if it has not already set. * @since 0.36.0 */ -final class AtGetOnly implements Attr { +final class AtWithRho implements Attr { + /** + * Original attribute. + */ + private final Attr origin; /** - * Get object supplier. + * Rho. */ - private final Supplier function; + private final Phi rho; /** * Ctor. - * @param func Get object function + * @param attr Attribute + * @param rho Rho */ - AtGetOnly(final Supplier func) { - this.function = func; + AtWithRho(final Attr attr, final Phi rho) { + this.origin = attr; + this.rho = rho; } @Override public Attr copy(final Phi self) { - throw new UnsupportedOperationException( - "Should never happen" + return new AtWithRho( + this.origin.copy(self), + self ); } @Override public Phi get() { - return this.function.get(); + Phi ret = this.origin.get(); + if (!ret.hasRho()) { + ret = ret.copy(); + ret.put(Attr.RHO, this.rho); + } + return ret; } @Override - public boolean put(final Phi phi) { - throw new UnsupportedOperationException( - "Should never happen" - ); + public void put(final Phi phi) { + this.origin.put(phi); } } diff --git a/eo-runtime/src/main/java/org/eolang/AtomSafe.java b/eo-runtime/src/main/java/org/eolang/AtomSafe.java index 94c1137d93..799a17cbe9 100644 --- a/eo-runtime/src/main/java/org/eolang/AtomSafe.java +++ b/eo-runtime/src/main/java/org/eolang/AtomSafe.java @@ -37,10 +37,10 @@ public final class AtomSafe implements Atom { /** * Ctor. - * @param atom Original atom. + * @param atom Phi as atom. */ - public AtomSafe(final Atom atom) { - this.origin = atom; + public AtomSafe(final Phi atom) { + this.origin = (Atom) atom; } @Override diff --git a/eo-runtime/src/main/java/org/eolang/Attr.java b/eo-runtime/src/main/java/org/eolang/Attr.java index 7c4c6f5ad6..c1958c4074 100644 --- a/eo-runtime/src/main/java/org/eolang/Attr.java +++ b/eo-runtime/src/main/java/org/eolang/Attr.java @@ -56,6 +56,8 @@ public interface Attr { /** * Take the object out. * + *

If attribute is not set - throws {@link ExUnset}.

+ * * @return The object */ Phi get(); @@ -64,7 +66,6 @@ public interface Attr { * Put a new object in. * * @param phi The object to put - * @return Was attribute set */ - boolean put(Phi phi); + void put(Phi phi); } diff --git a/eo-runtime/src/main/java/org/eolang/Data.java b/eo-runtime/src/main/java/org/eolang/Data.java index 5edd3b36e7..ce55f77119 100644 --- a/eo-runtime/src/main/java/org/eolang/Data.java +++ b/eo-runtime/src/main/java/org/eolang/Data.java @@ -85,19 +85,24 @@ public Phi copy() { return this.object.copy(); } + @Override + public boolean hasRho() { + return this.object.hasRho(); + } + @Override public Phi take(final String name) { return this.object.take(name); } @Override - public boolean put(final int pos, final Phi obj) { - return this.object.put(pos, obj); + public void put(final int pos, final Phi obj) { + this.object.put(pos, obj); } @Override - public boolean put(final String name, final Phi obj) { - return this.object.put(name, obj); + public void put(final String name, final Phi obj) { + this.object.put(name, obj); } @Override @@ -132,16 +137,12 @@ private static Phi toPhi(final Object obj) { phi = eolang.take("false"); } } else if (obj instanceof Phi[]) { - final Phi tuple = eolang.take("tuple"); - Phi argument = tuple.take("empty"); - Phi tup; + Phi tuple = eolang.take("tuple").take("empty"); for (final Phi element : (Phi[]) obj) { - tup = tuple.copy(); - tup.put(0, argument); - tup.put(1, element); - argument = tup; + tuple = tuple.take("with"); + tuple.put(0, element); } - phi = argument; + phi = tuple; } else if (obj instanceof byte[]) { phi = eolang.take("bytes").copy(); phi.put(0, new PhDefault((byte[]) obj)); diff --git a/eo-runtime/src/main/java/org/eolang/ExFailure.java b/eo-runtime/src/main/java/org/eolang/ExFailure.java index d0e731bebc..6ba677a7d6 100644 --- a/eo-runtime/src/main/java/org/eolang/ExFailure.java +++ b/eo-runtime/src/main/java/org/eolang/ExFailure.java @@ -54,4 +54,3 @@ public ExFailure(final String cause, final Throwable root) { super(cause, root); } } - diff --git a/eo-runtime/src/main/java/org/eolang/ExUnset.java b/eo-runtime/src/main/java/org/eolang/ExUnset.java index 2a7fbbecca..d46b1b1d47 100644 --- a/eo-runtime/src/main/java/org/eolang/ExUnset.java +++ b/eo-runtime/src/main/java/org/eolang/ExUnset.java @@ -54,4 +54,3 @@ public ExUnset(final String cause, final Throwable root) { super(cause, root); } } - diff --git a/eo-runtime/src/main/java/org/eolang/Expect.java b/eo-runtime/src/main/java/org/eolang/Expect.java index 9fd311f68d..dc266506e0 100644 --- a/eo-runtime/src/main/java/org/eolang/Expect.java +++ b/eo-runtime/src/main/java/org/eolang/Expect.java @@ -81,7 +81,13 @@ public static Expect at(final Phi phi, final String attr) { public Expect that(final Function fun) { return new Expect<>( this.subject, - () -> fun.apply(this.sup.get()) + () -> { + try { + return fun.apply(this.sup.get()); + } catch (final ExFailure ex) { + throw new ExThat(ex.getMessage(), ex); + } + } ); } @@ -96,9 +102,23 @@ public Expect otherwise(final String message) { () -> { try { return this.sup.get(); - } catch (final ExFailure ex) { - throw new ExFailure( - String.format("%s %s %s", this.subject, ex.getMessage(), message), + } catch (final ExMust ex) { + throw new ExOtherwise( + String.format( + "%s %s %s", + this.subject, + ex.getMessage(), + message + ), + ex + ); + } catch (final ExThat ex) { + throw new ExOtherwise( + String.format( + "%s %s", + this.subject, + message + ), ex ); } @@ -117,7 +137,7 @@ public Expect must(final Function fun) { () -> { final T ret = this.sup.get(); if (!fun.apply(ret)) { - throw new ExFailure( + throw new ExMust( String.format("(%s)", ret) ); } @@ -132,7 +152,170 @@ public Expect must(final Function fun) { * @checkstyle MethodNameCheck (5 lines) */ public T it() { - return this.sup.get(); + try { + return this.sup.get(); + } catch (final ExOtherwise ex) { + throw new ExFailure(ex.getMessage(), ex); + } + } + + /** + * This exception is used to enhance the error message + * in the {@link Expect#otherwise(String)} method. + * + * @since 0.51 + */ + private static final class ExMust extends RuntimeException { + /** + * Ctor. + * @param cause Exception cause + * @param args Arguments for {@link String#format(String, Object...)} + */ + ExMust(final String cause, final Object... args) { + super(String.format(cause, args)); + } + } + + /** + * This exception is used to enhance the error message + * in the {@link Expect#otherwise(String)} method. + * + * @since 0.51 + */ + private static final class ExThat extends RuntimeException { + /** + * Ctor. + * @param cause Exception cause + * @param args Arguments for {@link String#format(String, Object...)} + */ + ExThat(final String cause, final Object... args) { + super(String.format(cause, args)); + } + } + + /** + * This exception is used to enhance the error message + * in the {@link Expect#it()} method. + * + * @since 0.51 + */ + private static final class ExOtherwise extends RuntimeException { + /** + * Ctor. + * @param cause Exception cause + * @param args Arguments for {@link String#format(String, Object...)} + */ + ExOtherwise(final String cause, final Object... args) { + super(String.format(cause, args)); + } + } + + /** + * Transform Expect to Number. + * + * @since 0.51 + */ + public static final class Number { + + /** + * Expect. + */ + private final Expect expect; + + /** + * Ctor. + * @param expect Expect + */ + public Number(final Expect expect) { + this.expect = expect; + } + + /** + * Return it. + * @return The token + * @checkstyle MethodNameCheck (5 lines) + */ + public Double it() { + return this.expect + .that(phi -> new Dataized(phi).asNumber()) + .otherwise("must be a number") + .it(); + } + } + + /** + * Transform Expect to Integer. + * + * @since 0.51 + */ + public static final class Int { + + /** + * Expect. + */ + private final Expect expect; + + /** + * Ctor. + * @param expect Expect + */ + public Int(final Expect expect) { + this.expect = expect; + } + + /** + * Return it. + * @return The token + * @checkstyle MethodNameCheck (5 lines) + */ + public Integer it() { + return this.expect + .that(phi -> new Dataized(phi).asNumber()) + .otherwise("must be a number") + .must(number -> number % 1 == 0) + .otherwise("must be an integer") + .that(Double::intValue) + .it(); + } + } + + /** + * Transform Expect to Natural number. + * Natural number is integer greater or equal to zero. + * + * @since 0.51 + */ + public static final class Natural { + + /** + * Expect. + */ + private final Expect expect; + + /** + * Ctor. + * @param expect Expect + */ + public Natural(final Expect expect) { + this.expect = expect; + } + + /** + * Return it. + * @return The token + * @checkstyle MethodNameCheck (5 lines) + */ + public Integer it() { + return this.expect + .that(phi -> new Dataized(phi).asNumber()) + .otherwise("must be a number") + .must(number -> number % 1 == 0) + .otherwise("must be an integer") + .that(Double::intValue) + .must(integer -> integer >= 0) + .otherwise("must be greater or equal to zero") + .it(); + } } } diff --git a/eo-runtime/src/main/java/org/eolang/Main.java b/eo-runtime/src/main/java/org/eolang/Main.java index 9cda7a5358..e6c5ea4fe4 100644 --- a/eo-runtime/src/main/java/org/eolang/Main.java +++ b/eo-runtime/src/main/java/org/eolang/Main.java @@ -196,13 +196,10 @@ private static void run(final List opts) throws Exception { ); } if (opts.size() > 1) { - final Phi tuple = Phi.Φ.take("org").take("eolang").take("tuple"); - Phi args = tuple.take("empty"); + Phi args = Phi.Φ.take("org.eolang.tuple"); for (int idx = 1; idx < opts.size(); ++idx) { - final Phi arg = tuple.copy(); - arg.put(0, args); - arg.put(1, new Data.ToPhi(opts.get(idx))); - args = arg; + args = args.take("with"); + args.put(0, new Data.ToPhi(opts.get(idx))); } app.put(0, args); } diff --git a/eo-runtime/src/main/java/org/eolang/PhDefault.java b/eo-runtime/src/main/java/org/eolang/PhDefault.java index f731b8d65a..9e3be7cde9 100644 --- a/eo-runtime/src/main/java/org/eolang/PhDefault.java +++ b/eo-runtime/src/main/java/org/eolang/PhDefault.java @@ -96,12 +96,10 @@ public PhDefault() { * Ctor. * @param dta Object data */ - @SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors") public PhDefault(final byte[] dta) { this.data = Optional.ofNullable(dta); - this.attrs = new HashMap<>(0); + this.attrs = PhDefault.defaults(); this.order = new HashMap<>(0); - this.add(Attr.RHO, new AtRho()); } @Override @@ -130,12 +128,23 @@ public final Phi copy() { } @Override - public boolean put(final int pos, final Phi object) { - return this.put(this.attr(pos), object); + public boolean hasRho() { + boolean has = true; + try { + this.attrs.get(Attr.RHO).get(); + } catch (final ExUnset exception) { + has = false; + } + return has; + } + + @Override + public void put(final int pos, final Phi object) { + this.put(this.attr(pos), object); } @Override - public boolean put(final String name, final Phi object) { + public void put(final String name, final Phi object) { if (!this.attrs.containsKey(name)) { throw new ExUnset( String.format( @@ -144,7 +153,7 @@ public boolean put(final String name, final Phi object) { ) ); } - return this.attrs.get(name).put(object); + this.attrs.get(name).put(object); } @Override @@ -152,37 +161,25 @@ public Phi take(final String name) { PhDefault.NESTING.set(PhDefault.NESTING.get() + 1); final Phi object; if (this.attrs.containsKey(name)) { - object = new AtSetRho( - this.attrs.get(name), - this, - name - ).get(); + object = this.attrs.get(name).get(); } else if (name.equals(Attr.LAMBDA)) { - object = new AtSetRho( - new AtSimple(new AtomSafe((Atom) this).lambda()), - this, - name - ).get(); + object = new AtomSafe(this).lambda(); } else if (this instanceof Atom) { object = this.take(Attr.LAMBDA).take(name); } else if (this.attrs.containsKey(Attr.PHI)) { object = this.take(Attr.PHI).take(name); } else { - object = new AtGetOnly( - () -> { - throw new ExUnset( - String.format( - "Can't #take(\"%s\"), the attribute is absent among other %d attrs of %s:(%s), %s and %s are also absent", - name, - this.attrs.size(), - this.forma(), - String.join(", ", this.attrs.keySet()), - Attr.PHI, - Attr.LAMBDA - ) - ); - } - ).get(); + throw new ExUnset( + String.format( + "Can't #take(\"%s\"), the attribute is absent among other %d attrs of %s:(%s), %s and %s are also absent", + name, + this.attrs.size(), + this.forma(), + String.join(", ", this.attrs.keySet()), + Attr.PHI, + Attr.LAMBDA + ) + ); } PhDefault.debug( String.format( @@ -247,11 +244,11 @@ public String forma() { * @param name The name * @param attr The attr */ - protected final void add(final String name, final Attr attr) { + public final void add(final String name, final Attr attr) { if (PhDefault.SORTABLE.matcher(name).matches()) { this.order.put(this.order.size(), name); } - this.attrs.put(name, attr); + this.attrs.put(name, new AtWithRho(attr, this)); } /** @@ -305,6 +302,16 @@ private String oname() { return txt; } + /** + * Default attributes hash map with RHO attribute put. + * @return Default attributes hash map + */ + private static Map defaults() { + final Map attrs = new HashMap<>(0); + attrs.put(Attr.RHO, new AtRho()); + return attrs; + } + /** * Log debug message for PhDefault. * @param msg Message to log diff --git a/eo-runtime/src/main/java/org/eolang/PhFake.java b/eo-runtime/src/main/java/org/eolang/PhFake.java deleted file mode 100644 index 7459c63a89..0000000000 --- a/eo-runtime/src/main/java/org/eolang/PhFake.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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. - */ - -/* - * @checkstyle PackageNameCheck (4 lines) - */ -package org.eolang; - -import java.util.function.Supplier; - -/** - * Fake object, mostly for unit tests. - * - * @since 0.29 - */ -public final class PhFake extends PhDefault { - /** - * Ctor. - */ - public PhFake() { - this(() -> Phi.Φ); - } - - /** - * Ctor. - * @param sup The function to return the real object - */ - @SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors") - public PhFake(final Supplier sup) { - this.add("args", new AtVoid("args")); - this.add("φ", new AtComposite(this, rho -> sup.get())); - } -} diff --git a/eo-runtime/src/main/java/org/eolang/PhLambda.java b/eo-runtime/src/main/java/org/eolang/PhLambda.java deleted file mode 100644 index 70e2f64265..0000000000 --- a/eo-runtime/src/main/java/org/eolang/PhLambda.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -/** - * A method-calling object. - * - * @since 0.1 - */ -public final class PhLambda extends PhOnce { - PhLambda() { - super( - () -> { - return new PhDefault(); - } - ); - } -} diff --git a/eo-runtime/src/main/java/org/eolang/PhLogged.java b/eo-runtime/src/main/java/org/eolang/PhLogged.java index f678f2a582..4bd4c2dfd9 100644 --- a/eo-runtime/src/main/java/org/eolang/PhLogged.java +++ b/eo-runtime/src/main/java/org/eolang/PhLogged.java @@ -55,6 +55,14 @@ public Phi copy() { return ret; } + @Override + public boolean hasRho() { + System.out.printf("%d.hasRho()...\n", this.hashCode()); + final boolean ret = this.origin.hasRho(); + System.out.printf("%d.hasRho()! -> %b\n", this.hashCode(), ret); + return ret; + } + @Override public Phi take(final String name) { System.out.printf("%d.take(\"%s\")...\n", this.hashCode(), name); @@ -64,19 +72,17 @@ public Phi take(final String name) { } @Override - public boolean put(final int pos, final Phi object) { + public void put(final int pos, final Phi object) { System.out.printf("%d.put(%d, %d)...\n", this.hashCode(), pos, object.hashCode()); - final boolean ret = this.origin.put(pos, object); + this.origin.put(pos, object); System.out.printf("%d.put(%d, %d)!\n", this.hashCode(), pos, object.hashCode()); - return ret; } @Override - public boolean put(final String name, final Phi object) { + public void put(final String name, final Phi object) { System.out.printf("%d.put(\"%s\", %d)...\n", this.hashCode(), name, object.hashCode()); - final boolean ret = this.origin.put(name, object); + this.origin.put(name, object); System.out.printf("%d.put(\"%s\", %d)!\n", this.hashCode(), name, object.hashCode()); - return ret; } @Override diff --git a/eo-runtime/src/main/java/org/eolang/PhOnce.java b/eo-runtime/src/main/java/org/eolang/PhOnce.java index ca1de124f4..82d0b43756 100644 --- a/eo-runtime/src/main/java/org/eolang/PhOnce.java +++ b/eo-runtime/src/main/java/org/eolang/PhOnce.java @@ -80,19 +80,24 @@ public Phi copy() { ); } + @Override + public boolean hasRho() { + return this.object.get().hasRho(); + } + @Override public Phi take(final String name) { return this.object.get().take(name); } @Override - public boolean put(final int pos, final Phi obj) { - return this.object.get().put(pos, obj); + public void put(final int pos, final Phi obj) { + this.object.get().put(pos, obj); } @Override - public boolean put(final String name, final Phi obj) { - return this.object.get().put(name, obj); + public void put(final String name, final Phi obj) { + this.object.get().put(name, obj); } @Override diff --git a/eo-runtime/src/main/java/org/eolang/PhPackage.java b/eo-runtime/src/main/java/org/eolang/PhPackage.java index 207cbd75e2..e3112d06f8 100644 --- a/eo-runtime/src/main/java/org/eolang/PhPackage.java +++ b/eo-runtime/src/main/java/org/eolang/PhPackage.java @@ -77,6 +77,11 @@ public Phi copy() { ); } + @Override + public boolean hasRho() { + return true; + } + @Override public Phi take(final String name) { final String obj = this.eoPackage(name); @@ -94,7 +99,7 @@ public Phi take(final String name) { } @Override - public boolean put(final int pos, final Phi object) { + public void put(final int pos, final Phi object) { throw new IllegalStateException( String.format( "Can't #put(%d, %s) to package object \"%s\"", @@ -104,7 +109,7 @@ public boolean put(final int pos, final Phi object) { } @Override - public boolean put(final String name, final Phi object) { + public void put(final String name, final Phi object) { throw new IllegalStateException( String.format( "Can't #put(%s, %s) to package object \"%s\"", diff --git a/eo-runtime/src/main/java/org/eolang/PhSafe.java b/eo-runtime/src/main/java/org/eolang/PhSafe.java index 87adb0fe24..d6d1bba5af 100644 --- a/eo-runtime/src/main/java/org/eolang/PhSafe.java +++ b/eo-runtime/src/main/java/org/eolang/PhSafe.java @@ -27,6 +27,7 @@ import EOorg.EOeolang.EOerror; import java.util.LinkedList; import java.util.List; +import java.util.function.Supplier; /** * An object with coordinates (line and position) and a safe @@ -129,19 +130,24 @@ public Phi copy() { ); } + @Override + public boolean hasRho() { + return this.through(this.origin::hasRho); + } + @Override public Phi take(final String name) { return this.through(() -> this.origin.take(name)); } @Override - public boolean put(final int pos, final Phi object) { - return this.through(() -> this.origin.put(pos, object)); + public void put(final int pos, final Phi object) { + this.through(() -> this.origin.put(pos, object)); } @Override - public boolean put(final String nme, final Phi object) { - return this.through(() -> this.origin.put(nme, object)); + public void put(final String nme, final Phi object) { + this.through(() -> this.origin.put(nme, object)); } @Override @@ -161,7 +167,21 @@ public byte[] delta() { @Override public Phi lambda() { - return this.through(() -> new AtomSafe((Atom) this.origin).lambda(), ".λ"); + return this.through(new AtomSafe(this.origin)::lambda, ".λ"); + } + + /** + * Helper, for other methods. + * @param action The action + */ + private void through(final Runnable action) { + this.through( + () -> { + action.run(); + return true; + }, + "" + ); } /** @@ -170,7 +190,7 @@ public Phi lambda() { * @param Type of result * @return Result */ - private T through(final Action action) { + private T through(final Supplier action) { return this.through(action, ""); } @@ -188,9 +208,9 @@ private T through(final Action action) { * @checkstyle IllegalCatchCheck (20 lines) */ @SuppressWarnings({"PMD.AvoidCatchingThrowable", "PMD.PreserveStackTrace"}) - private T through(final Action action, final String suffix) { + private T through(final Supplier action, final String suffix) { try { - return action.act(); + return action.get(); } catch (final EOerror.ExError ex) { throw new EOerror.ExError(ex, this.label(suffix)); } catch (final ExAbstract ex) { diff --git a/eo-runtime/src/main/java/org/eolang/Phi.java b/eo-runtime/src/main/java/org/eolang/Phi.java index cbd5084999..d15dd228cf 100644 --- a/eo-runtime/src/main/java/org/eolang/Phi.java +++ b/eo-runtime/src/main/java/org/eolang/Phi.java @@ -66,20 +66,25 @@ public Phi copy() { return Phi.Φ; } + @Override + public boolean hasRho() { + return false; + } + @Override public Phi take(final String name) { return this.pkg.take(name); } @Override - public boolean put(final int pos, final Phi object) { + public void put(final int pos, final Phi object) { throw new IllegalStateException( String.format("Can't #put(%d, %s) to Φ", pos, object) ); } @Override - public boolean put(final String name, final Phi object) { + public void put(final String name, final Phi object) { throw new IllegalStateException( String.format("Can't #put(%s, %s) to Φ", name, object) ); @@ -110,6 +115,12 @@ public byte[] delta() { */ Phi copy(); + /** + * Returns true if object has bound rho attribute. + * @return True if object has rho bound attribute + */ + boolean hasRho(); + /** * Take object by name of the attribute. * @param name The name of the attribute @@ -121,17 +132,15 @@ public byte[] delta() { * Put object by position of the attribute. * @param pos The position of the attribute. * @param object The object to put - * @return Was attribute set */ - boolean put(int pos, Phi object); + void put(int pos, Phi object); /** * Put object by name of the attribute. * @param name The name of the attribute. * @param object The object to put - * @return Was attribute set */ - boolean put(String name, Phi object); + void put(String name, Phi object); /** * Get code locator of the phi. diff --git a/eo-runtime/src/main/java/org/eolang/XmirPackage.java b/eo-runtime/src/main/java/org/eolang/XmirPackage.java deleted file mode 100644 index f7dd91f60d..0000000000 --- a/eo-runtime/src/main/java/org/eolang/XmirPackage.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for a Java package made from XMIR meta. - * - * @since 0.49 - */ -@Target(ElementType.PACKAGE) -@Retention(RetentionPolicy.CLASS) -public @interface XmirPackage { - - /** - * The name of the package in EO. - * - * @return The name as it is in EO - */ - String value() default ""; - -} diff --git a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo index 21abf6ccd6..1d27ff2f3b 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo @@ -30,10 +30,10 @@ # This unit test is supposed to check the functionality of the corresponding object. [] > bound-tmpfile-does-not-recreates-file - tmpdir.tmpfile > f + tmpdir.tmpfile.as-file > f f.path.eq f.path > @ -# test. +# This unit test is supposed to check the functionality of the corresponding object. [] > makes-new-directory (tmpdir.tmpfile.deleted.as-path.resolved "foo-new").as-dir.made > d and. > @ diff --git a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo index ac623ef70b..39668ce60b 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo @@ -30,6 +30,7 @@ +tests +package org.eolang.fs +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > check-if-current-directory-is-directory diff --git a/eo-runtime/src/test/eo/org/eolang/go-tests.eo b/eo-runtime/src/test/eo/org/eolang/go-tests.eo index b512b64188..119dbeb711 100644 --- a/eo-runtime/src/test/eo/org/eolang/go-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/go-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > goto-jumps-backwards diff --git a/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo b/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo index 289bd57569..ca9866307d 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo @@ -28,6 +28,7 @@ +tests +package org.eolang.io +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > reads-from-bytes-and-writes-to-memory @@ -80,4 +81,3 @@ m1.write 5 2A- m1 01-02-03-04-05-2A - diff --git a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo index 2bbcd0fe7d..92c0fd2540 100644 --- a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > writes-into-memory-of diff --git a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo index dbd22a4bc2..ba448698ca 100644 --- a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo @@ -441,4 +441,3 @@ # This unit test is supposed to check the functionality of the corresponding object. [] > negative-infinity-is-not-integer negative-infinity.is-integer.not > @ - diff --git a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo index 03eb2a0295..91c039fcac 100644 --- a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +unlint abstract-decoratee ++unlint broken-ref +version 0.0.0 # This unit test is supposed to check the globals bound objects work as tests. diff --git a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo index 0a948ea818..0708de2145 100644 --- a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > seq-single-dataization-float-less diff --git a/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo index 0f0bd65701..47922e0aad 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo @@ -27,6 +27,7 @@ +tests +package org.eolang.structs +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > list-should-not-be-empty diff --git a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo index 32fdce1096..b6464135c0 100644 --- a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > switch-simple-case diff --git a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo index 4a17dd40b1..23f11ebb9f 100644 --- a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo @@ -167,14 +167,14 @@ [] > at-fast-with-first-element * 100 101 102 > arr eq. > @ - (arr.at 0).at-fast arr 3 + (arr.at 0).at-fast arr 100 # Test [] > at-fast-with-last-element * 100 101 102 > arr eq. > @ - (arr.at 2).at-fast arr 3 + (arr.at 2).at-fast arr 102 # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo index eb86554e00..0fd3c2cb3b 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo @@ -33,21 +33,21 @@ [] > sscanf-with-string eq. > @ "hello" - tail. + value. sscanf "%s" "hello" # This unit test is supposed to check the functionality of the corresponding object. [] > sscanf-with-int eq. > @ 33 - tail. + value. sscanf "%d" "33" # This unit test is supposed to check the functionality of the corresponding object. [] > sscanf-with-float eq. > @ 0.24 - tail. + value. sscanf "%f" "0.24" # This unit test is supposed to check the functionality of the corresponding object. @@ -67,28 +67,28 @@ [] > sscanf-with-string-with-ending eq. > @ "hello" - tail. + value. sscanf "%s!" "hello!" # This unit test is supposed to check the functionality of the corresponding object. [] > sscanf-with-complex-string eq. > @ "test" - tail. + value. sscanf "some%sstring" "someteststring" # This unit test is supposed to check the functionality of the corresponding object. [] > sscanf-with-complex-int eq. > @ 734987259 - tail. + value. sscanf "!%d!" "!734987259!" # This unit test is supposed to check the functionality of the corresponding object. [] > sscanf-with-complex-float eq. > @ 1991.01 - tail. + value. sscanf "this will be=%f" "this will be=1991.01" # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/while-tests.eo b/eo-runtime/src/test/eo/org/eolang/while-tests.eo index 7bdb7f1fa7..85c84f7e01 100644 --- a/eo-runtime/src/test/eo/org/eolang/while-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/while-tests.eo @@ -25,6 +25,7 @@ +tests +package org.eolang +version 0.0.0 ++unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. [] > while-dataizes-only-first-cycle diff --git a/eo-runtime/src/test/groovy/verify.groovy b/eo-runtime/src/test/groovy/verify.groovy index ab86f7059c..00260853ec 100644 --- a/eo-runtime/src/test/groovy/verify.groovy +++ b/eo-runtime/src/test/groovy/verify.groovy @@ -39,4 +39,3 @@ List tests = [ for (it in tests) { evaluate folder.resolve(it).toFile() } - diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/InputOutputTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/InputOutputTest.java index 8d17de84b0..eee591868b 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOio/InputOutputTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOio/InputOutputTest.java @@ -323,16 +323,15 @@ void writesToConsoleSequentially(@Mktmp final Path temp) throws IOException { final File file = InputOutputTest.redirectedStdout( temp, () -> { - final Phi buffer = new Data.ToPhi("Ha"); final Phi first = new PhWith( Phi.Φ.take(InputOutputTest.CONSOLE).take(InputOutputTest.WRITE).copy(), - 0, buffer + 0, new Data.ToPhi("Hey") ); final Phi second = new PhWith( new PhCopy( new PhMethod(first, InputOutputTest.WRITE) ), - 0, buffer + 0, new Data.ToPhi("There") ); new Dataized(second).take(); } @@ -340,7 +339,10 @@ void writesToConsoleSequentially(@Mktmp final Path temp) throws IOException { MatcherAssert.assertThat( "The 'console.write' should have return output block ready to write again, but it didn't", Files.readString(Paths.get(file.getAbsolutePath()), StandardCharsets.UTF_8), - Matchers.containsString("HaHa") + Matchers.allOf( + Matchers.containsString("Hey"), + Matchers.containsString("There") + ) ); } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOnumber$EOtimesTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOnumber$EOtimesTest.java index 5ab7c653a4..62bc918ec5 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOnumber$EOtimesTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOnumber$EOtimesTest.java @@ -48,7 +48,30 @@ final class EOnumber$EOtimesTest { @Test - void throwsCorrectError() { + void throwsCorrectErrorWhenRhoAttrIsWrong() { + MatcherAssert.assertThat( + "the message in the error is correct", + Assertions.assertThrows( + ExAbstract.class, + () -> new Dataized( + new PhWith( + new PhWith( + new EOnumber$EOtimes(), + Attr.RHO, + new Data.ToPhi(true) + ), + "x", + new Data.ToPhi(42) + ) + ).take(), + "Attr.RHO must be a number, not anything else" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute must be a number") + ); + } + + @Test + void throwsCorrectErrorWhenXAttrIsWrong() { MatcherAssert.assertThat( "the message in the error is correct", Assertions.assertThrows( @@ -66,7 +89,7 @@ void throwsCorrectError() { ).take(), "multiplies 3 by TRUE and fails with a proper message that explains what happened" ).getMessage(), - Matchers.containsString("number.times expects its second argument to be a number") + Matchers.equalTo("the 'x' attribute must be a number") ); } } diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOposixTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOposixTest.java index 26d2a17952..c885669f46 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOposixTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOposixTest.java @@ -27,7 +27,6 @@ */ package EOorg.EOeolang.EOsys; // NOPMD -import EOorg.EOeolang.EOtuple$EOempty; import java.lang.management.ManagementFactory; import org.eolang.Data; import org.eolang.Dataized; @@ -59,7 +58,7 @@ void invokesGetpidCorrectly() { new Data.ToPhi("getpid") ), "args", - new EOtuple$EOempty() + Phi.Φ.take("org.eolang.tuple").take("empty") ).take("code") ).asNumber().intValue(), Matchers.equalTo( diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOwin32Test.java b/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOwin32Test.java index e2529a172c..878e31bd8f 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOwin32Test.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/EOsys/EOwin32Test.java @@ -29,7 +29,6 @@ import EOorg.EOeolang.EOsys.Win32.WSAStartupFuncCall; import EOorg.EOeolang.EOsys.Win32.Winsock; -import EOorg.EOeolang.EOtuple$EOempty; import java.lang.management.ManagementFactory; import org.eolang.Data; import org.eolang.Dataized; @@ -65,7 +64,7 @@ void invokesGetCurrentProcessIdCorrectly() { new Data.ToPhi("GetCurrentProcessId") ), "args", - new EOtuple$EOempty() + Phi.Φ.take("org.eolang.tuple").take("empty") ).take("code") ).asNumber().intValue(), Matchers.equalTo( diff --git a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java index 84480e28c4..0fb0e63921 100644 --- a/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java +++ b/eo-runtime/src/test/java/EOorg/EOeolang/HeapsTest.java @@ -28,9 +28,12 @@ */ package EOorg.EOeolang; // NOPMD +import java.util.function.Supplier; +import org.eolang.AtComposite; import org.eolang.AtCompositeTest; +import org.eolang.AtVoid; import org.eolang.ExFailure; -import org.eolang.PhFake; +import org.eolang.PhDefault; import org.eolang.Phi; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; @@ -51,7 +54,7 @@ final class HeapsTest { @Test void allocatesMemory() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 10); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 10); Assertions.assertDoesNotThrow( () -> HeapsTest.HEAPS.read(idx, 0, 10), AtCompositeTest.TO_ADD_MESSAGE @@ -61,7 +64,7 @@ void allocatesMemory() { @Test void failsOnDoubleAllocation() { - final Phi phi = new PhFake(); + final Phi phi = new HeapsTest.PhFake(); final int idx = HeapsTest.HEAPS.malloc(phi, 10); Assertions.assertThrows( ExFailure.class, @@ -73,7 +76,7 @@ void failsOnDoubleAllocation() { @Test void allocatesAndReadsEmptyBytes() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); MatcherAssert.assertThat( AtCompositeTest.TO_ADD_MESSAGE, HeapsTest.HEAPS.read(idx, 0, 5), @@ -84,7 +87,7 @@ void allocatesAndReadsEmptyBytes() { @Test void writesAndReads() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); final byte[] bytes = {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); MatcherAssert.assertThat( @@ -99,7 +102,7 @@ void writesAndReads() { void failsOnWriteToEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.write(new PhFake().hashCode(), 0, new byte[] {0x01}), + () -> HeapsTest.HEAPS.write(new HeapsTest.PhFake().hashCode(), 0, new byte[] {0x01}), AtCompositeTest.TO_ADD_MESSAGE ); } @@ -108,14 +111,14 @@ void failsOnWriteToEmptyBlock() { void failsOnReadFromEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.read(new PhFake().hashCode(), 0, 1), + () -> HeapsTest.HEAPS.read(new HeapsTest.PhFake().hashCode(), 0, 1), AtCompositeTest.TO_ADD_MESSAGE ); } @Test void failsOnReadIfOutOfBounds() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 2); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 2); Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.read(idx, 1, 3), @@ -125,7 +128,7 @@ void failsOnReadIfOutOfBounds() { @Test void readsByOffsetAndLength() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 2, 3, 4, 5}); MatcherAssert.assertThat( AtCompositeTest.TO_ADD_MESSAGE, @@ -136,7 +139,7 @@ void readsByOffsetAndLength() { @Test void failsOnWriteMoreThanAllocated() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 2); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 2); final byte[] bytes = {1, 2, 3, 4, 5}; Assertions.assertThrows( ExFailure.class, @@ -148,7 +151,7 @@ void failsOnWriteMoreThanAllocated() { @Test void failsToWriteMoreThanAllocatedWithOffset() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 3); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 3); final byte[] bytes = {1, 2, 3}; Assertions.assertThrows( ExFailure.class, @@ -160,7 +163,7 @@ void failsToWriteMoreThanAllocatedWithOffset() { @Test void concatsOnWriteLessThanAllocated() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); HeapsTest.HEAPS.write(idx, 0, new byte[] {1, 1, 3, 4, 5}); HeapsTest.HEAPS.write(idx, 2, new byte[] {2, 2}); MatcherAssert.assertThat( @@ -173,7 +176,7 @@ void concatsOnWriteLessThanAllocated() { @Test void freesSuccessfully() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); HeapsTest.HEAPS.free(idx); Assertions.assertThrows( ExFailure.class, @@ -186,7 +189,7 @@ void freesSuccessfully() { void failsOnClearingEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.free(new PhFake().hashCode()), + () -> HeapsTest.HEAPS.free(new HeapsTest.PhFake().hashCode()), AtCompositeTest.TO_ADD_MESSAGE ); } @@ -195,14 +198,14 @@ void failsOnClearingEmptyBlock() { void throwsOnGettingSizeOfEmptyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.size(new PhFake().hashCode()), + () -> HeapsTest.HEAPS.size(new HeapsTest.PhFake().hashCode()), "Heaps should throw an exception if trying to get size on an empty block, but it didn't" ); } @Test void returnsValidSize() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); MatcherAssert.assertThat( "Heaps should return valid size of allocated block, but it didn't", HeapsTest.HEAPS.size(idx), @@ -213,7 +216,7 @@ void returnsValidSize() { @Test void throwsOnChangingSizeToNegative() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); Assertions.assertThrows( ExFailure.class, () -> HeapsTest.HEAPS.resize(idx, -1), @@ -226,14 +229,14 @@ void throwsOnChangingSizeToNegative() { void throwsOnChangeSizeOfEmtpyBlock() { Assertions.assertThrows( ExFailure.class, - () -> HeapsTest.HEAPS.resize(new PhFake().hashCode(), 10), + () -> HeapsTest.HEAPS.resize(new HeapsTest.PhFake().hashCode(), 10), "Heaps should throw an exception on changing size of empty block, but it didn't" ); } @Test void increasesSizeSuccessfully() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); final byte[] bytes = {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); HeapsTest.HEAPS.resize(idx, 7); @@ -247,7 +250,7 @@ void increasesSizeSuccessfully() { @Test void decreasesSizeSuccessfully() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); final byte[] bytes = {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); HeapsTest.HEAPS.resize(idx, 3); @@ -261,7 +264,7 @@ void decreasesSizeSuccessfully() { @Test void returnsValidSizeAfterDecreasing() { - final int idx = HeapsTest.HEAPS.malloc(new PhFake(), 5); + final int idx = HeapsTest.HEAPS.malloc(new HeapsTest.PhFake(), 5); final byte[] bytes = {1, 2, 3, 4, 5}; HeapsTest.HEAPS.write(idx, 0, bytes); HeapsTest.HEAPS.resize(idx, 3); @@ -273,4 +276,27 @@ void returnsValidSizeAfterDecreasing() { HeapsTest.HEAPS.free(idx); } + /** + * Fake object, mostly for unit tests. + * + * @since 0.29 + */ + private static final class PhFake extends PhDefault { + /** + * Ctor. + */ + PhFake() { + this(() -> Phi.Φ); + } + + /** + * Ctor. + * @param sup The function to return the real object + */ + @SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors") + PhFake(final Supplier sup) { + this.add("args", new AtVoid("args")); + this.add("φ", new AtComposite(this, rho -> sup.get())); + } + } } diff --git a/eo-runtime/src/test/java/integration/SnippetIT.java b/eo-runtime/src/test/java/integration/SnippetIT.java old mode 100755 new mode 100644 diff --git a/eo-runtime/src/main/java/org/eolang/AtEnvelope.java b/eo-runtime/src/test/java/org/eolang/AtEnvelope.java similarity index 87% rename from eo-runtime/src/main/java/org/eolang/AtEnvelope.java rename to eo-runtime/src/test/java/org/eolang/AtEnvelope.java index 4d770a652b..6b28f01286 100644 --- a/eo-runtime/src/main/java/org/eolang/AtEnvelope.java +++ b/eo-runtime/src/test/java/org/eolang/AtEnvelope.java @@ -30,7 +30,8 @@ * @since 0.36.0 * @checkstyle DesignForExtensionCheck (100 lines) */ -public abstract class AtEnvelope implements Attr { +@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleCorrectTestName"}) +abstract class AtEnvelope implements Attr { /** * Original attribute. */ @@ -40,7 +41,7 @@ public abstract class AtEnvelope implements Attr { * Ctor. * @param attr Attribute */ - public AtEnvelope(final Attr attr) { + AtEnvelope(final Attr attr) { this.origin = attr; } @@ -55,7 +56,7 @@ public Phi get() { } @Override - public boolean put(final Phi phi) { - return this.origin.put(phi); + public void put(final Phi phi) { + this.origin.put(phi); } } diff --git a/eo-runtime/src/main/java/org/eolang/AtSimple.java b/eo-runtime/src/test/java/org/eolang/AtSimple.java similarity index 86% rename from eo-runtime/src/main/java/org/eolang/AtSimple.java rename to eo-runtime/src/test/java/org/eolang/AtSimple.java index 9d2616f33f..7fbd4ae200 100644 --- a/eo-runtime/src/main/java/org/eolang/AtSimple.java +++ b/eo-runtime/src/test/java/org/eolang/AtSimple.java @@ -32,11 +32,16 @@ * * @since 0.1 */ -public final class AtSimple extends AtEnvelope { +@SuppressWarnings({ + "JTCOP.RuleAllTestsHaveProductionClass", + "JTCOP.RuleCorrectTestName", + "JTCOP.RuleInheritanceInTests" +}) +final class AtSimple extends AtEnvelope { /** * Ctor. */ - public AtSimple() { + AtSimple() { this(Phi.Φ); } @@ -44,7 +49,7 @@ public AtSimple() { * Ctor. * @param object Object that attribute keeps */ - public AtSimple(final Phi object) { + AtSimple(final Phi object) { super(new AtComposite(object, arg -> object)); } } diff --git a/eo-runtime/src/test/java/org/eolang/ExpectTest.java b/eo-runtime/src/test/java/org/eolang/ExpectTest.java index 6793e27c66..6b1fa81880 100644 --- a/eo-runtime/src/test/java/org/eolang/ExpectTest.java +++ b/eo-runtime/src/test/java/org/eolang/ExpectTest.java @@ -33,12 +33,13 @@ * * @since 0.1.0 */ +@SuppressWarnings("PMD.TooManyMethods") final class ExpectTest { @Test - void buildsAndChecks() { + void buildsAndChecksWithoutErrors() { MatcherAssert.assertThat( - "passes through and throws correctly", + "Passes checks", new Expect<>("something", () -> 42) .must(i -> i > 0) .otherwise("must be positive") @@ -50,9 +51,9 @@ void buildsAndChecks() { } @Test - void failsWithCorrectTrace() { + void failsWithCorrectTraceWithOneError() { MatcherAssert.assertThat( - "error message is correct", + "Throw error in first 'must'. Error message is correct", Assertions.assertThrows( ExFailure.class, () -> new Expect<>("a number", () -> 42) @@ -61,7 +62,238 @@ void failsWithCorrectTrace() { .it(), "fails on check" ).getMessage(), - Matchers.containsString("negative") + Matchers.equalTo("a number (42) must be negative") ); } + + @Test + void failsWithCorrectTraceWithTwoErrors() { + MatcherAssert.assertThat( + "Throw error in first 'must'. Not add error about second 'must'", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect<>("a number", () -> 42.2) + .must(i -> i < 0) + .otherwise("must be negative") + .must(i -> i % 1 == 0) + .otherwise("must be an integer") + .it(), + "fails only for first 'must'" + ).getMessage(), + Matchers.equalTo("a number (42.2) must be negative") + ); + } + + @Test + void failsWithCorrectTraceWithOneOkAndOneError() { + MatcherAssert.assertThat( + "Throw error in second 'must'. First 'must' passes check", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect<>("a number", () -> 42.2) + .must(i -> i > 0) + .otherwise("must be positive") + .must(i -> i % 1 == 0) + .otherwise("must be an integer") + .it(), + "fails on checking integer" + ).getMessage(), + Matchers.equalTo("a number (42.2) must be an integer") + ); + } + + @Test + void failsWithCorrectTraceWithExFailureInThat() { + MatcherAssert.assertThat( + "Take error message from 'otherwise', not from original error", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect<>("attr", () -> 42.2) + .that( + i -> { + throw new ExFailure("Some error in operation"); + } + ) + .otherwise("must be converted to something") + .it(), + "fails on 'that' because of some internal error" + ).getMessage(), + Matchers.equalTo("attr must be converted to something") + ); + } + + @Test + void failsWithCorrectTraceWithExFailureInThatForParsing() { + MatcherAssert.assertThat( + "Take error message from 'otherwise', not from original error", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect<>("attr", () -> "string") + .that( + i -> { + try { + return Integer.parseInt(i); + } catch (final NumberFormatException ex) { + throw new ExFailure("Can't parse to integer", ex); + } + } + ) + .otherwise("must be an integer") + .it(), + "fails on 'that' because can not parse" + ).getMessage(), + Matchers.equalTo("attr must be an integer") + ); + } + + @Test + void failsWithCorrectTraceForMustAndThat() { + MatcherAssert.assertThat( + "Take error message from must", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect<>("attr", () -> "string") + .must(i -> false) + .otherwise("in must") + .that(i -> i) + .otherwise("in that") + .it(), + "fails on 'must'" + ).getMessage(), + Matchers.equalTo("attr (string) in must") + ); + } + + @Test + void failsInTransformingToNumberForNotNumber() { + MatcherAssert.assertThat( + "inner class Number working throws error if attr is not a number", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Number( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(true) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to Number" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute must be a number") + ); + } + + @Test + void failsInTransformingToIntegerForNotNumber() { + MatcherAssert.assertThat( + "inner class Integer throws error for not a number", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Int( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(true) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to Integer" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute must be a number") + ); + } + + @Test + void failsInTransformingToIntegerForNotInteger() { + MatcherAssert.assertThat( + "inner class Integer throws error for not an integer number", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Int( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(42.23) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to Integer" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute (42.23) must be an integer") + ); + } + + @Test + void failsInTransformingToNonNegativeIntegerForNotNumber() { + MatcherAssert.assertThat( + "inner class NonNegativeInteger throws error for not a number", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Natural( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(true) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to NonNegativeInteger" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute must be a number") + ); + } + + @Test + void failsInTransformingToNonNegativeIntegerForNotInteger() { + MatcherAssert.assertThat( + "inner class NonNegativeInteger throws error for not an integer number", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Natural( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(42.23) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to NonNegativeInteger" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute (42.23) must be an integer") + ); + } + + @Test + void failsInTransformingToNonNegativeIntegerForNegative() { + MatcherAssert.assertThat( + "inner class NonNegativeInteger throws error for a negative integer", + Assertions.assertThrows( + ExFailure.class, + () -> new Expect.Natural( + Expect.at( + new PhWith( + new PhDefault(), + Attr.RHO, + new Data.ToPhi(-42) + ), + Attr.RHO + ) + ).it(), + "fails with correct error message while transform Phi to NonNegativeInteger" + ).getMessage(), + Matchers.equalTo("the 'ρ' attribute (-42) must be greater or equal to zero") + ); + } + } diff --git a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java index dee7ea8e9d..e50e67d62b 100644 --- a/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhDefaultTest.java @@ -493,7 +493,7 @@ private static class Rnd extends PhDefault { "φ", new AtComposite( this, - self -> new ToPhi(new SecureRandom().nextDouble()) + self -> new Data.ToPhi(new SecureRandom().nextDouble()) ) ); } diff --git a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java index 1f28017705..c912ea81e5 100644 --- a/eo-runtime/src/test/java/org/eolang/PhPackageTest.java +++ b/eo-runtime/src/test/java/org/eolang/PhPackageTest.java @@ -23,7 +23,6 @@ */ package org.eolang; -import EOorg.EOeolang.EObytes$EOas_number; import EOorg.EOeolang.EObytes$EOeq; import EOorg.EOeolang.EOgo; import java.util.Collections; @@ -182,7 +181,6 @@ void findsAttributesConcurrently() throws InterruptedException { private static Stream attributes() { return Stream.of( Arguments.of("absent", PhPackage.class), - Arguments.of("bytes$as-number", EObytes$EOas_number.class), Arguments.of("bytes$eq", EObytes$EOeq.class), Arguments.of("go", EOgo.class) ); diff --git a/eo-runtime/src/test/java/org/eolang/XmirObjectTest.java b/eo-runtime/src/test/java/org/eolang/XmirObjectTest.java index 076d794192..7b89aa4902 100644 --- a/eo-runtime/src/test/java/org/eolang/XmirObjectTest.java +++ b/eo-runtime/src/test/java/org/eolang/XmirObjectTest.java @@ -33,16 +33,22 @@ import java.util.stream.Collectors; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; /** * Test case for {@link XmirObject}. * * @since 0.38 + * @todo #3481:30min Enable the test. The test was disabled because it's became a bit + * irrelevant when we got rid of @ref attributes and "abstract-float-up.xsl" transformation. + * We got a much less amount of generated classes after translation to java. So we need to + * refactor the test and enable it. */ final class XmirObjectTest { @Test + @Disabled void annotatesOnlyPublicClasses() throws IOException { final Set> clazzes = ClassPath.from(ClassLoader.getSystemClassLoader()) .getAllClasses() diff --git a/eo-runtime/src/test/resources/jul.properties b/eo-runtime/src/test/resources/jul.properties index 21613df71d..e3a5be9401 100644 --- a/eo-runtime/src/test/resources/jul.properties +++ b/eo-runtime/src/test/resources/jul.properties @@ -21,4 +21,4 @@ # SOFTWARE. handlers = org.slf4j.bridge.SLF4JBridgeHandler -.level=INFO \ No newline at end of file +.level=INFO diff --git a/pom.xml b/pom.xml index 56fd154636..9b3d26dd6f 100644 --- a/pom.xml +++ b/pom.xml @@ -260,7 +260,7 @@ SOFTWARE. org.eolang xax test - 0.5.1 + 0.6.2
com.yegor256 diff --git a/renovate.json b/renovate.json index bd247f30df..e252fc2ba3 100644 --- a/renovate.json +++ b/renovate.json @@ -3,13 +3,15 @@ "extends": [ "config:base" ], + "ignoreDeps": [ + "org.apache.maven.plugins:maven-compiler-plugin" + ], "packageRules": [ { - "matchPackageNames": ["maven-compiler-plugin"], - "allowedVersions": "3.8.1" + "allowedVersions": "3.8.1", + "matchPackageNames": [ + "maven-compiler-plugin" + ] } - ], - "ignoreDeps": [ - "org.apache.maven.plugins:maven-compiler-plugin" ] } From d8b1bc4be0f707030978679efda8e777c529f547 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 07:52:48 +0300 Subject: [PATCH 08/23] #3797: rm --- .../org/eolang/parser/eo-typos/trailing-space-in-comment.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml diff --git a/eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml b/eo-parser/src/test/resources/org/eolang/parser/eo-typos/trailing-space-in-comment.yaml deleted file mode 100644 index e69de29bb2..0000000000 From 5df2501fe9f9fe7b03c5f3c08057bb1bd28ad27e Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 08:22:05 +0300 Subject: [PATCH 09/23] #3797: log testing removed --- eo-maven-plugin/pom.xml | 6 + .../org/eolang/maven/AssembleMojoTest.java | 19 -- .../java/org/eolang/maven/LogFormatTest.java | 82 -------- .../java/org/eolang/maven/PullMojoTest.java | 28 --- .../java/org/eolang/maven/SafeMojoTest.java | 61 ------ .../org/eolang/maven/log/CaptureLogs.java | 178 ------------------ .../test/java/org/eolang/maven/log/Logs.java | 152 --------------- .../org/eolang/maven/log/package-info.java | 30 --- .../org/eolang/maven/util/HmOptionalTest.java | 30 --- .../src/test/resources/log4j.properties | 27 +-- .../test/resources/org/eolang/maven/mess.eo | 3 + 11 files changed, 11 insertions(+), 605 deletions(-) delete mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java delete mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java delete mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/log/CaptureLogs.java delete mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/log/Logs.java delete mode 100644 eo-maven-plugin/src/test/java/org/eolang/maven/log/package-info.java diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 216a4b0955..f88feef8a6 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -43,6 +43,12 @@ SOFTWARE. org.eolang lints 1.0-SNAPSHOT + + + org.slf4j + slf4j-simple + + org.glassfish 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 2e4be6a5b0..f74763b471 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 @@ -29,8 +29,6 @@ import java.io.IOException; import java.nio.file.Path; import java.util.Map; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; @@ -120,23 +118,6 @@ void assemblesNotFailWithFailOnError(@Mktmp final Path temp) throws IOException ); } - @CaptureLogs - @Test - void assemblesSuccessfullyInOfflineMode(final Logs out, - @Mktmp final Path temp) throws IOException { - new FakeMaven(temp) - .withHelloWorld() - .with("offline", true) - .execute(AssembleMojo.class); - MatcherAssert.assertThat( - "While execution AssembleMojo log should have contained message about offline mode, but it didn't", - String.join("\n", out.captured()), - Matchers.containsString( - "No programs were pulled because eo.offline flag is set to TRUE" - ) - ); - } - @Test void configuresChildParameters(@Mktmp final Path temp) throws IOException { final Map res = new FakeMaven(temp) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java deleted file mode 100644 index 44f6e9cbf1..0000000000 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/LogFormatTest.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -import com.jcabi.log.Logger; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.parallel.Execution; -import org.junit.jupiter.api.parallel.ExecutionMode; - -/** - * Tests of the log4j logger messages format. - * - *

All log messages are written to System.out. System.out is a shared resource among all other - * threads. For this reason, we run tests in this class in the same thread (disabling parallelism). - * This approach prevents log messages from other threads from interfering. Since all the tests in - * this class are relatively fast, it does not significantly impact overall performance. - * We disable parallelism by using the {@link Execution} annotation with - * {@link ExecutionMode#SAME_THREAD}. DO NOT REMOVE THAT ANNOTATION!

- * - * @since 0.28.11 - */ -@Execution(ExecutionMode.SAME_THREAD) -@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass") -final class LogFormatTest { - - /** - * Expected log message format. - */ - private static final String FORMAT = - "^\\d{2}:\\d{2}:\\d{2} \\[INFO] org.eolang.maven.LogFormatTest: Wake up, Neo...\\R"; - - @Test - @CaptureLogs - void printsFormattedMessage(final Logs out) { - final String msg = "Wake up, Neo..."; - Logger.info(this, msg); - final String actual = out.waitForMessage(msg); - MatcherAssert.assertThat( - String.format( - "Actual log output is '%s', but expected pattern is: '%s'", - actual, - LogFormatTest.FORMAT - ), - actual, - Matchers.matchesPattern(LogFormatTest.FORMAT) - ); - } - - @Test - void matchesCorrectly() { - MatcherAssert.assertThat( - CatalogsTest.TO_ADD_MESSAGE, - "16:02:08 [INFO] org.eolang.maven.LogFormatTest: Wake up, Neo...\n", - Matchers.matchesPattern(LogFormatTest.FORMAT) - ); - } -} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java index 0c00b1d444..8a87f54711 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/PullMojoTest.java @@ -44,13 +44,10 @@ import org.eolang.maven.hash.ChRemote; import org.eolang.maven.hash.ChText; import org.eolang.maven.hash.CommitHash; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; import org.eolang.maven.util.HmBase; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.io.FileMatchers; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -183,31 +180,6 @@ void doesNotPullInOfflineMode(@Mktmp final Path tmp) throws IOException { ); } - @Test - @CaptureLogs - void showsWhereNotFoundWasDiscoveredAt(@Mktmp final Path tmp, final Logs out) - throws IOException { - final FakeMaven mvn = new FakeMaven(tmp) - .withProgram( - "+package com.example\n", - "# No comments.", - "[] > main", - " org.eolang.org > @" - ) - .with("objectionary", new OyRemote(new ChRemote("master"))); - Assertions.assertThrows( - Exception.class, - () -> mvn.execute(new FakeMaven.Pull()), - "Pull mojo should fail, but it does not" - ); - Assertions.assertTrue( - out.captured().stream().anyMatch( - line -> line.contains("Failed to pull 'org.eolang.org' earlier discovered at") - ), - "Log should contain info where failed to pull object was discovered at, but it does not" - ); - } - @Test void skipsAlreadyPulled(@Mktmp final Path temp) throws IOException { final FakeMaven maven = new FakeMaven(temp) diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java deleted file mode 100644 index 2dc643690c..0000000000 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/SafeMojoTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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; - -import com.yegor256.Mktmp; -import com.yegor256.MktmpResolver; -import java.nio.file.Path; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; - -/** - * Test case for {@link SafeMojo}. - * - * @since 0.1 - */ -@ExtendWith(MktmpResolver.class) -final class SafeMojoTest { - - @Test - @CaptureLogs - void logsStackTrace(final Logs out, @Mktmp final Path temp) { - Assertions.assertDoesNotThrow( - () -> new FakeMaven(temp) - .withProgram("something > is definitely wrong here") - .execute(new FakeMaven.Parse()), - CatalogsTest.TO_ADD_MESSAGE - ); - MatcherAssert.assertThat( - CatalogsTest.TO_ADD_MESSAGE, - String.join("\n", out.captured()), - Matchers.containsString("Failed to parse") - ); - } - -} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/log/CaptureLogs.java b/eo-maven-plugin/src/test/java/org/eolang/maven/log/CaptureLogs.java deleted file mode 100644 index fb88560d00..0000000000 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/log/CaptureLogs.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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.log; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.util.Enumeration; -import org.apache.log4j.Appender; -import org.apache.log4j.ConsoleAppender; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggingEvent; -import org.junit.jupiter.api.extension.AfterEachCallback; -import org.junit.jupiter.api.extension.BeforeEachCallback; -import org.junit.jupiter.api.extension.ExtendWith; -import org.junit.jupiter.api.extension.ExtensionContext; -import org.junit.jupiter.api.extension.ParameterContext; -import org.junit.jupiter.api.extension.ParameterResolver; - -/** - * Captured logs annotation for tests. - * @todo #2896:90min Make '@CaptureLogs' thread-safe. - * 'Logs' should contain only messages related to the test. - * Currently, '@CaptureLogs' appends all messages that - * were logged via 'Logger' to 'Logs', so messages from - * other tests (run in parallel) are also included, which causes - * problems when tests are run in parallel. - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -@ExtendWith(CaptureLogs.CaptureLogsExtension.class) -@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass") -public @interface CaptureLogs { - - /** - * JUnit extension to capture log messages. - * - * @since 0.30 - */ - final class CaptureLogsExtension implements - ParameterResolver, BeforeEachCallback, AfterEachCallback { - - /** - * Logs. - */ - private final Logs logs; - - /** - * Appender. - */ - private final CaptureLogsAppender appender; - - /** - * Ctor. - */ - CaptureLogsExtension() { - this(new Logs()); - } - - /** - * Ctor. - * @param logs Where to save logs from the appender. - */ - private CaptureLogsExtension(final Logs logs) { - this(logs, new CaptureLogsAppender(logs)); - } - - /** - * Ctor. - * @param logs Where to save logs from the appender. - * @param appender Appender to use. - */ - private CaptureLogsExtension(final Logs logs, final CaptureLogsAppender appender) { - this.logs = logs; - this.appender = appender; - } - - @Override - public void beforeEach(final ExtensionContext context) { - this.appender.init(); - } - - @Override - public void afterEach(final ExtensionContext context) { - this.appender.destroy(); - } - - @Override - public boolean supportsParameter( - final ParameterContext param, - final ExtensionContext extension - ) { - return param.getParameter().getType() == Logs.class; - } - - @Override - public Object resolveParameter( - final ParameterContext param, - final ExtensionContext extension - ) { - return this.logs; - } - } - - /** - * Log4j logger appender. - * - * @since 0.30 - */ - final class CaptureLogsAppender extends ConsoleAppender { - - /** - * Where to save logs from the appender. - */ - private final Logs logs; - - /** - * Ctor. - * @param logs Where to save logs from the appender. - */ - CaptureLogsAppender(final Logs logs) { - this.logs = logs; - } - - @Override - public void append(final LoggingEvent event) { - this.logs.append(this.getLayout().format(event)); - } - - /** - * Initialize the appender. - * Adds appender to the root logger. - */ - void init() { - final Logger logger = LogManager.getRootLogger(); - final Enumeration appenders = logger.getAllAppenders(); - if (appenders.hasMoreElements()) { - final Object next = appenders.nextElement(); - if (next instanceof ConsoleAppender) { - this.setLayout(((Appender) next).getLayout()); - } - } - logger.addAppender(this); - this.logs.waitForInit(); - } - - /** - * Destroy the appender. - * Removes appender from the root logger. - */ - void destroy() { - LogManager.getRootLogger().removeAppender(this); - } - } -} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/log/Logs.java b/eo-maven-plugin/src/test/java/org/eolang/maven/log/Logs.java deleted file mode 100644 index d660589705..0000000000 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/log/Logs.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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.log; - -import com.jcabi.log.Logger; -import java.util.Collection; -import java.util.Collections; -import java.util.Optional; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; - -/** - * Captured logs. - * - * @since 0.30 - */ -@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleCorrectTestName"}) -public final class Logs { - - /** - * Captured logs. - */ - private final Collection container; - - /** - * Ctor. - */ - Logs() { - this(new ConcurrentLinkedQueue<>()); - } - - /** - * Ctor. - * @param collection Captured logs. - */ - private Logs(final Collection collection) { - this.container = collection; - } - - /** - * Return all captured logs up to this point. - * @return Captured logs. - */ - public Collection captured() { - return Collections.unmodifiableCollection(this.container); - } - - /** - * Since logging is usually asynchronous, we need to wait for the message to appear in the - * output. Moreover, logging system can take extra time to initialize. - * @param message Expected part of the message - * @return Logged message with formatting - */ - public String waitForMessage(final String message) { - return this.waitForMessage( - message, - () -> { - } - ); - } - - /** - * Waits until the logger is initialized. - * If that method is finished it means that loggers are initialized. - */ - void waitForInit() { - final String msg = "ping"; - this.waitForMessage(msg, () -> Logger.info(this, msg)); - } - - /** - * Append log message. - * @param log Log message. - */ - void append(final String log) { - this.container.add(log); - } - - /** - * Wait for message. - * @param message Message to wait for - * @param action Action to perform before checking the message on each check iteration - * @return Logged message - */ - private String waitForMessage(final String message, final Runnable action) { - try { - return Executors.newSingleThreadExecutor().submit( - () -> { - while (true) { - action.run(); - final Optional full = this.container.stream() - .filter(s -> s.contains(message)) - .findFirst(); - if (full.isPresent()) { - return full.get(); - } - } - } - ).get(10, TimeUnit.SECONDS); - } catch (final InterruptedException exception) { - Thread.currentThread().interrupt(); - throw new IllegalStateException( - String.format( - "Waiting thread was interrupted, can't read '%s' msg", - message - ), - exception - ); - } catch (final ExecutionException exception) { - throw new IllegalStateException( - String.format( - "Some problem happened, can't read '%s' msg", - message - ), - exception - ); - } catch (final TimeoutException exception) { - throw new IllegalStateException( - String.format( - "Timeout limit exceed to read msg %s, current set of captured logs: %s", - message, - this.container - ), - exception - ); - } - } -} diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/log/package-info.java b/eo-maven-plugin/src/test/java/org/eolang/maven/log/package-info.java deleted file mode 100644 index ca77c3923e..0000000000 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/log/package-info.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2016-2025 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. - */ -/** - * The package for log capturing during unit tests. - * Includes JUnit extension and a logger appender. - * - * @since 0.30 - */ -package org.eolang.maven.log; diff --git a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmOptionalTest.java b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmOptionalTest.java index ff5b6753be..b33c609d31 100644 --- a/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmOptionalTest.java +++ b/eo-maven-plugin/src/test/java/org/eolang/maven/util/HmOptionalTest.java @@ -32,8 +32,6 @@ import org.cactoos.text.Randomized; import org.cactoos.text.TextOf; import org.cactoos.text.UncheckedText; -import org.eolang.maven.log.CaptureLogs; -import org.eolang.maven.log.Logs; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.junit.jupiter.api.Assertions; @@ -99,34 +97,6 @@ void savesIfFileExistsAndRewriteTrue(@Mktmp final Path dir) throws IOException { ); } - @Test - @CaptureLogs - void savesIfFileExistsAndRewriteFalse( - @Mktmp final Path dir, - final Logs out) throws IOException { - final String first = new UncheckedText(new Randomized(this.size)).asString(); - final Path file = Paths.get(this.sample); - final HmBase base = new HmBase(dir); - base.save(first, file); - final HmOptional optional = new HmOptional(base, false); - final String second = new UncheckedText(new Randomized(this.size)).asString(); - optional.save(second, file); - final Path absolute = dir.resolve(file); - MatcherAssert.assertThat( - "The first file shouldn't be rewritten.", - new UncheckedText(new TextOf(absolute)).asString(), - Matchers.is(first) - ); - Assertions.assertTrue( - out.captured().stream().anyMatch( - log -> log.contains( - String.format("Rewriting of the %s file was skipped", absolute) - ) - ), - "When user tries to rewrite a file, a log should be shown." - ); - } - @Test void exists(@Mktmp final Path dir) throws IOException { final Path file = Paths.get(this.sample); diff --git a/eo-maven-plugin/src/test/resources/log4j.properties b/eo-maven-plugin/src/test/resources/log4j.properties index 688203f165..c8d557433c 100644 --- a/eo-maven-plugin/src/test/resources/log4j.properties +++ b/eo-maven-plugin/src/test/resources/log4j.properties @@ -26,28 +26,5 @@ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=com.jcabi.log.MulticolorLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss} [%p] %c: %m%n -log4j.logger.org.eolang=INFO -log4j.logger.org.eolang.maven.log.Logs=INFO -log4j.logger.com.yegor256.Jaxec=WARN -log4j.logger.com.yegor256.farea=WARN -log4j.logger.org.eolang.parser.Syntax=WARN -log4j.logger.org.eolang.maven.PlaceMojo=WARN -log4j.logger.org.eolang.maven.DiscoverMojo=WARN -log4j.logger.org.eolang.maven.RegisterMojo=WARN -log4j.logger.org.eolang.maven.CleanMojo=WARN -log4j.logger.org.eolang.maven.PhiMojo=WARN -log4j.logger.org.eolang.maven.ShakeMojo=WARN -log4j.logger.org.eolang.maven.UnphiMojo=WARN -log4j.logger.org.eolang.maven.LintMojo=INFO -log4j.logger.org.eolang.maven.ParseMojo=WARN -log4j.logger.org.eolang.maven.PrintMojo=WARN -log4j.logger.org.eolang.maven.OyIndexed=ERROR -log4j.logger.com.jcabi.log.VerboseProcess=WARN -log4j.logger.org.eolang.parser.EoSyntax=WARN -log4j.logger.org.eolang.parser.Program=WARN -log4j.logger.org.eolang.maven.SodgMojo=WARN -log4j.logger.org.eolang.maven.SodgMojoTest=WARN -log4j.logger.org.eolang.maven.TargetSpy=WARN -log4j.logger.org.eolang.parser.Scenario=WARN -log4j.logger.org.eolang.maven.Save=WARN -log4j.logger.com.yegor256.xsline.Xsline=WARN +log4j.logger.com.yegor256.farea=OFF +log4j.logger.org.eolang=OFF diff --git a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo index 8cce0e0fc2..83d66c4e5b 100644 --- a/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo +++ b/eo-maven-plugin/src/test/resources/org/eolang/maven/mess.eo @@ -27,7 +27,10 @@ +tests +package org.eolang.examples +version 0.0.0 ++unlint atom-is-not-unique +unlint broken-ref ++unlint incorrect-alias ++unlint object-is-not-unique 3.14 > pi From 446afceb94291ee9fddd50ab957d6b76af09e80a Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 14:06:00 +0300 Subject: [PATCH 10/23] #3797: more polished --- .../src/main/java/org/eolang/maven/LintMojo.java | 3 +++ .../src/main/java/org/eolang/maven/SafeMojo.java | 12 ++++++++++++ eo-runtime/src/main/eo/org/eolang/net/socket.eo | 8 ++++---- eo-runtime/src/test/eo/org/eolang/bool-tests.eo | 2 +- eo-runtime/src/test/eo/org/eolang/number-tests.eo | 2 +- eo-runtime/src/test/eo/org/eolang/string-tests.eo | 2 +- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index bda6a1132c..49f35dc792 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -165,6 +165,9 @@ private int lintAll(final ConcurrentHashMap counts) throws IO for (final ForeignTojo tojo : this.scopedTojos().withLinted()) { paths.put(tojo.identifier(), tojo.linted()); } + for (final ForeignTojo tojo : this.compileTojos().withLinted()) { + paths.put(tojo.identifier(), tojo.linted()); + } final Map pkg = new HashMap<>(); for (final Map.Entry ent : paths.entrySet()) { pkg.put(ent.getKey(), new XMLDocument(ent.getValue())); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java index d4134bcace..f92f6b168d 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java @@ -358,6 +358,18 @@ protected final ForeignTojos scopedTojos() { return this.tojos; } + /** + * Tojos to use, in "compile" scope only. + * @return Tojos to use + * @checkstyle AnonInnerLengthCheck (100 lines) + */ + protected final ForeignTojos compileTojos() { + return new ForeignTojos( + () -> Catalogs.INSTANCE.make(this.foreign.toPath(), this.foreignFormat), + () -> "compile" + ); + } + /** * Make a measured train from another train. * @param train The train diff --git a/eo-runtime/src/main/eo/org/eolang/net/socket.eo b/eo-runtime/src/main/eo/org/eolang/net/socket.eo index 1809240ca2..563daf0356 100644 --- a/eo-runtime/src/main/eo/org/eolang/net/socket.eo +++ b/eo-runtime/src/main/eo/org/eolang/net/socket.eo @@ -186,10 +186,10 @@ [sockfd] > scoped-socket # Makes an `input` from `socket`. # The object allows to use `socket` as input stream and `read` from it sequentially. - as-input recv > as-input + ^.^.as-input recv > as-input # Makes an `output` from posix socket. # The object allows to use `socket` as output stream and `write` to it sequentially. - as-output send > as-output + ^.^.as-output send > as-output # Send bytes through the socket. # Here `buffer` must be an object that can be dataized. @@ -379,10 +379,10 @@ [sockfd] > scoped-socket # Makes an `input` from win32 `socket`. # The object allows to use `socket` as input stream and `read` from it sequentially. - as-input recv > as-input + ^.^.as-input recv > as-input # Makes an `output` from win32 socket. # The object allows to use `socket` as output stream and `write` to it sequentially. - as-output send > as-output + ^.^.as-output send > as-output # Send bytes through the socket. # Here `buffer` must be an object that can be dataized. diff --git a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo index eabdb9ee4b..b61cf42070 100644 --- a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo @@ -37,7 +37,7 @@ true.as-bool > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-types +[] > compares-two-different-bool-types not. > @ eq. true diff --git a/eo-runtime/src/test/eo/org/eolang/number-tests.eo b/eo-runtime/src/test/eo/org/eolang/number-tests.eo index c1cdda3e18..baf0d77bcf 100644 --- a/eo-runtime/src/test/eo/org/eolang/number-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/number-tests.eo @@ -188,7 +188,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-types +[] > compares-two-different-number-types eq. > @ 68.eq "12345678" false diff --git a/eo-runtime/src/test/eo/org/eolang/string-tests.eo b/eo-runtime/src/test/eo/org/eolang/string-tests.eo index 1c139d93d5..0cd4f6c942 100644 --- a/eo-runtime/src/test/eo/org/eolang/string-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/string-tests.eo @@ -79,7 +79,7 @@ should-be-smile.length > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-types +[] > compares-two-different-string-types not. > @ eq. "Hello" From 1fc7f69569d71acf80a15c1b535ad0708290e17d Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 14:19:04 +0300 Subject: [PATCH 11/23] #3797: merge From 4be4bc262f1d167135842202a1621288cdcd5b9c Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 14:23:04 +0300 Subject: [PATCH 12/23] #3797: master From 8145d1576b0b5d8f5d5bb8d2ddc320be6da5849f Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 20:34:12 +0300 Subject: [PATCH 13/23] #3797: no exclusion --- eo-maven-plugin/pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index f88feef8a6..216a4b0955 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -43,12 +43,6 @@ SOFTWARE. org.eolang lints 1.0-SNAPSHOT - - - org.slf4j - slf4j-simple - -
org.glassfish From 67ebbba6a374ea78af5f1fe8dc646ea37e33517b Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 21:22:25 +0300 Subject: [PATCH 14/23] #3797: more --- .../src/main/java/org/eolang/maven/LintMojo.java | 8 ++++---- .../main/java/org/eolang/maven/tojos/ForeignTojos.java | 8 -------- eo-runtime/pom.xml | 1 - 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java index 49f35dc792..96c4c73347 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/LintMojo.java @@ -162,11 +162,11 @@ private int lintOne(final ForeignTojo tojo, */ private int lintAll(final ConcurrentHashMap counts) throws IOException { final Map paths = new HashMap<>(); - for (final ForeignTojo tojo : this.scopedTojos().withLinted()) { - paths.put(tojo.identifier(), tojo.linted()); + for (final ForeignTojo tojo : this.scopedTojos().withShaken()) { + paths.put(tojo.identifier(), tojo.shaken()); } - for (final ForeignTojo tojo : this.compileTojos().withLinted()) { - paths.put(tojo.identifier(), tojo.linted()); + for (final ForeignTojo tojo : this.compileTojos().withShaken()) { + paths.put(tojo.identifier(), tojo.shaken()); } final Map pkg = new HashMap<>(); for (final Map.Entry ent : paths.entrySet()) { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java index bb29c02c85..0440447bce 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/tojos/ForeignTojos.java @@ -161,14 +161,6 @@ public Collection withShaken() { return this.select(row -> row.exists(Attribute.SHAKEN.getKey())); } - /** - * Get the tojos that have corresponding linted XMIR. - * @return The tojos. - */ - public Collection withLinted() { - return this.select(row -> row.exists(Attribute.LINTED.getKey())); - } - /** * Get the tojos that doesn't have dependency. * @return The tojos. diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index d775fe051d..08db2255b2 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -236,7 +236,6 @@ SOFTWARE. register deps assemble - lint transpile xmir-to-phi phi-to-xmir From 91b29a29195f2739a73a06d65c724f9e975b7bdd Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 21:29:12 +0300 Subject: [PATCH 15/23] #3797: test names --- .../src/test/eo/org/eolang/bool-tests.eo | 20 +-- .../src/test/eo/org/eolang/bytes-tests.eo | 116 ++++++------ eo-runtime/src/test/eo/org/eolang/cti-test.eo | 2 +- .../src/test/eo/org/eolang/dataized-tests.eo | 4 +- .../src/test/eo/org/eolang/fs/dir-tests.eo | 14 +- .../src/test/eo/org/eolang/fs/file-tests.eo | 66 +++---- .../src/test/eo/org/eolang/fs/path-tests.eo | 74 ++++---- eo-runtime/src/test/eo/org/eolang/go-tests.eo | 8 +- .../src/test/eo/org/eolang/i16-tests.eo | 52 +++--- .../src/test/eo/org/eolang/i32-tests.eo | 56 +++--- .../src/test/eo/org/eolang/i64-tests.eo | 50 +++--- .../eo/org/eolang/io/bytes-as-input-test.eo | 2 +- .../src/test/eo/org/eolang/io/console-test.eo | 2 +- .../test/eo/org/eolang/io/dead-input-tests.eo | 2 +- .../eo/org/eolang/io/input-length-tests.eo | 4 +- .../eo/org/eolang/io/malloc-as-output-test.eo | 4 +- .../src/test/eo/org/eolang/io/stdout-test.eo | 2 +- .../test/eo/org/eolang/io/tee-input-tests.eo | 6 +- .../src/test/eo/org/eolang/malloc-tests.eo | 60 +++---- .../test/eo/org/eolang/math/angle-tests.eo | 12 +- .../test/eo/org/eolang/math/integral-tests.eo | 6 +- .../test/eo/org/eolang/math/numbers-tests.eo | 16 +- .../test/eo/org/eolang/math/random-tests.eo | 8 +- .../src/test/eo/org/eolang/math/real-tests.eo | 168 +++++++++--------- .../src/test/eo/org/eolang/nan-tests.eo | 40 ++--- .../eo/org/eolang/negative-infinity-tests.eo | 134 +++++++------- .../src/test/eo/org/eolang/number-tests.eo | 68 +++---- .../eo/org/eolang/positive-infinity-tests.eo | 130 +++++++------- .../src/test/eo/org/eolang/runtime-tests.eo | 58 +++--- .../src/test/eo/org/eolang/seq-tests.eo | 18 +- .../src/test/eo/org/eolang/string-tests.eo | 74 ++++---- .../eolang/structs/bytes-as-array-tests.eo | 6 +- .../org/eolang/structs/hash-code-of-tests.eo | 36 ++-- .../test/eo/org/eolang/structs/list-tests.eo | 106 +++++------ .../test/eo/org/eolang/structs/map-tests.eo | 24 +-- .../org/eolang/structs/range-of-ints-tests.eo | 14 +- .../test/eo/org/eolang/structs/range-tests.eo | 8 +- .../test/eo/org/eolang/structs/set-tests.eo | 8 +- .../src/test/eo/org/eolang/switch-tests.eo | 12 +- .../src/test/eo/org/eolang/sys/os-tests.eo | 2 +- .../src/test/eo/org/eolang/sys/posix-tests.eo | 8 +- .../src/test/eo/org/eolang/sys/win32-tests.eo | 2 +- .../src/test/eo/org/eolang/try-tests.eo | 8 +- .../src/test/eo/org/eolang/tuple-tests.eo | 40 ++--- .../src/test/eo/org/eolang/txt/regex-tests.eo | 44 ++--- .../test/eo/org/eolang/txt/sprintf-tests.eo | 20 +-- .../test/eo/org/eolang/txt/sscanf-tests.eo | 22 +-- .../src/test/eo/org/eolang/txt/text-tests.eo | 136 +++++++------- .../src/test/eo/org/eolang/while-tests.eo | 20 +-- 49 files changed, 896 insertions(+), 896 deletions(-) diff --git a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo index b61cf42070..8a84c5bd16 100644 --- a/eo-runtime/src/test/eo/org/eolang/bool-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bool-tests.eo @@ -27,55 +27,55 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-bools +[] > tests-compares-two-bools eq. > @ true true # This unit test is supposed to check the functionality of the corresponding object. -[] > true-as-bool +[] > tests-true-as-bool true.as-bool > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-bool-types +[] > tests-compares-two-different-bool-types not. > @ eq. true 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-bool-to-bytes +[] > tests-compares-bool-to-bytes and. > @ true.eq 01- false.eq 00- # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-bool-to-string +[] > tests-compares-bool-to-string and. > @ true.eq "\001" false.eq "\000" # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-bool-to-bytes-reverse +[] > tests-compares-bool-to-bytes-reverse and. > @ 01-.as-bytes.eq true 00-.as-bytes.eq false # This unit test is supposed to check the functionality of the corresponding object. -[] > true-not-is-false +[] > tests-true-not-is-false eq. > @ true.not false # This unit test is supposed to check the functionality of the corresponding object. -[] > true-and-false-is-false +[] > tests-true-and-false-is-false not. > @ and. true false # This unit test is supposed to check the functionality of the corresponding object. -[] > forks-on-true-condition +[] > tests-forks-on-true-condition eq. > @ if. 5.eq 5 @@ -84,7 +84,7 @@ 123 # This unit test is supposed to check the functionality of the corresponding object. -[] > forks-on-false-condition +[] > tests-forks-on-false-condition eq. > @ if. 5.eq 8 diff --git a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo index c1be0ff709..d2ac68b9d4 100644 --- a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo @@ -27,7 +27,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > takes-part-of-bytes +[] > tests-takes-part-of-bytes eq. > @ slice. 20-1F-EE-B5-90 @@ -36,7 +36,7 @@ 1F-EE-B5 # This unit test is supposed to check the functionality of the corresponding object. -[] > size-of-part-is-correct +[] > tests-size-of-part-is-correct eq. > @ size. slice. @@ -46,42 +46,42 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > counts-size-of-bytes +[] > tests-counts-size-of-bytes eq. > @ size. F1-20-5F-EC-B5-90-32 7 # This unit test is supposed to check the functionality of the corresponding object. -[] > turns-bytes-into-a-string +[] > tests-turns-bytes-into-a-string eq. > @ string E4-BD-A0-E5-A5-BD-2C-20-D0-B4-D1-80-D1-83-D0-B3-21 "你好, друг!" # This unit test is supposed to check the functionality of the corresponding object. -[] > left-zero +[] > tests-left-zero not. > @ eq. 0.as-bytes.left 1 -1.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > left-with-zero +[] > tests-left-with-zero not. > @ eq. 2.as-bytes.left 0 -3.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > left-with-odd-neg +[] > tests-left-with-odd-neg not. > @ eq. -17.as-bytes.left 1 33.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > left-with-minus-one +[] > tests-left-with-minus-one eq. > @ eq. -1.as-bytes.left 3 @@ -90,55 +90,55 @@ # This unit test is supposed to check the functionality of the corresponding object. # (-18.left 2).eq 71.not -[] > left-with-even-neg +[] > tests-left-with-even-neg eq. > @ FF-FF-FF-FF-FF-FF-FF-EE.left 2 00-00-00-00-00-00-00-47.not # This unit test is supposed to check the functionality of the corresponding object. -[] > left-with-even-plus +[] > tests-left-with-even-plus not. > @ eq. 4.as-bytes.left 3 -33.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > left-with-odd-plus +[] > tests-left-with-odd-plus not. > @ eq. 5.as-bytes.left 3 -41.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-zero +[] > tests-right-with-zero not. > @ eq. 0.as-bytes.right 2 -1.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-odd-neg +[] > tests-right-with-odd-neg not. > @ eq. -37.as-bytes.right 3 4.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-minus-one +[] > tests-right-with-minus-one not. > @ eq. -1.as-bytes.right 4 0.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-even-neg +[] > tests-right-with-even-neg not. > @ eq. -38.as-bytes.right 1 18.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-even-plus +[] > tests-right-with-even-plus eq. > @ eq. 36.as-bytes.right 2 @@ -146,14 +146,14 @@ false # This unit test is supposed to check the functionality of the corresponding object. -[] > right-with-odd-plus +[] > tests-right-with-odd-plus not. > @ eq. 37.as-bytes.right 3 -5.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > and-with-zero +[] > tests-and-with-zero not. > @ eq. and. @@ -162,14 +162,14 @@ -1.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > and-with-two-neg +[] > tests-and-with-two-neg not. > @ eq. -6.as-bytes.and -4.as-bytes 7.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > and-with-two-plus +[] > tests-and-with-two-plus not. > @ eq. and. @@ -178,91 +178,91 @@ -1.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > and-with-one-neg-one-plus +[] > tests-and-with-one-neg-one-plus not. > @ eq. -7.as-bytes.and 7.as-bytes -2.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > or-with-zero +[] > tests-or-with-zero not. > @ eq. -11.as-bytes.or 0.as-bytes 10.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > or-with-two-neg +[] > tests-or-with-two-neg not. > @ eq. -27.as-bytes.or -13.as-bytes 8.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > or-with-two-plus +[] > tests-or-with-two-plus not. > @ eq. 5.as-bytes.or 14.as-bytes -16.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > or-with-one-neg-one-plus +[] > tests-or-with-one-neg-one-plus not. > @ eq. -7.as-bytes.or 23.as-bytes 0.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > xor-with-zero +[] > tests-xor-with-zero not. > @ eq. 0.as-bytes.xor 29.as-bytes -30.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > xor-with-two-neg +[] > tests-xor-with-two-neg not. > @ eq. -1.as-bytes.xor -123.as-bytes -123.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > xor-with-two-plus +[] > tests-xor-with-two-plus not. > @ eq. 53.as-bytes.xor 24.as-bytes -46.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > xor-with-one-neg-one-plus +[] > tests-xor-with-one-neg-one-plus not. > @ eq. -36.as-bytes.xor 43.as-bytes 8.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > not-with-zero +[] > tests-not-with-zero not. > @ eq. 0.as-bytes 0.as-bytes.not # This unit test is supposed to check the functionality of the corresponding object. -[] > not-with-neg +[] > tests-not-with-neg not. > @ eq. -1.as-bytes -1.as-bytes.not # This unit test is supposed to check the functionality of the corresponding object. -[] > not-with-plus +[] > tests-not-with-plus not. > @ eq. 53.as-bytes 53.as-bytes.not # This unit test is supposed to check the functionality of the corresponding object. -[] > conjunction-of-bytes +[] > tests-conjunction-of-bytes 02-EF-D4-05-5E-78-3A > a 12-33-C1-B5-5E-71-55 > b eq. > @ @@ -270,7 +270,7 @@ 02-23-C0-05-5E-70-10 # This unit test is supposed to check the functionality of the corresponding object. -[] > written-in-several-lines +[] > tests-written-in-several-lines eq. > @ size. CA-FE- @@ -278,7 +278,7 @@ 4 # This unit test is supposed to check the functionality of the corresponding object. -[] > bitwise-works +[] > tests-bitwise-works eq. > @ as-number. and. @@ -287,7 +287,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > convertible-to-bool +[] > tests-convertible-to-bool not. > @ eq. 01-.as-bool @@ -295,7 +295,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # (-127.or 127).eq -1 -[] > bitwise-works-negative +[] > tests-bitwise-works-negative eq. > @ as-number. or. @@ -304,7 +304,7 @@ FF-FF-FF-FF-FF-FF-FF-FF # This unit test is supposed to check the functionality of the corresponding object. -[] > concatenation-of-bytes +[] > tests-concatenation-of-bytes 02-EF-D4-05-5E-78-3A > a 12-33-C1-B5-5E-71-55 > b eq. > @ @@ -312,7 +312,7 @@ 02-EF-D4-05-5E-78-3A-12-33-C1-B5-5E-71-55 # This unit test is supposed to check the functionality of the corresponding object. -[] > concat-bools-as-bytes +[] > tests-concat-bools-as-bytes true.as-bytes > b1 false.as-bytes > b2 eq. > @ @@ -322,7 +322,7 @@ 01-00 # This unit test is supposed to check the functionality of the corresponding object. -[] > concat-with-empty +[] > tests-concat-with-empty eq. > @ concat. 05-5E-78 @@ -330,7 +330,7 @@ 05-5E-78 # This unit test is supposed to check the functionality of the corresponding object. -[] > concat-empty-with +[] > tests-concat-empty-with eq. > @ concat. -- @@ -338,7 +338,7 @@ 05-5E-78 # This unit test is supposed to check the functionality of the corresponding object. -[] > concat-empty +[] > tests-concat-empty eq. > @ concat. -- @@ -346,7 +346,7 @@ -- # This unit test is supposed to check the functionality of the corresponding object. -[] > concat-strings +[] > tests-concat-strings concat. > s-bytes "hello ".as-bytes "world".as-bytes @@ -356,94 +356,94 @@ # This unit test is supposed to check the functionality of the corresponding object. # (2397719729.xor 4294967295).eq 1897247566 -[] > xor-works +[] > tests-xor-works eq. > @ 00-00-00-00-8E-EA-4C-B1.xor 00-00-00-00-FF-FF-FF-FF 00-00-00-00-71-15-B3-4E # This unit test is supposed to check the functionality of the corresponding object. -[] > one-xor-one-as-number +[] > tests-one-xor-one-as-number eq. > @ (1.as-bytes.xor 1.as-bytes).as-number 0 # This unit test is supposed to check the functionality of the corresponding object. # (2397719729.or -4294967296).eq -1897247567 -[] > or-neg-bytes-with-leading-zeroes +[] > tests-or-neg-bytes-with-leading-zeroes eq. > @ 00-00-00-00-8E-EA-4C-B1.or FF-FF-FF-FF-00-00-00-00 FF-FF-FF-FF-8E-EA-4C-B1 # This unit test is supposed to check the functionality of the corresponding object. # (2397719729.and -4294967296).eq 0 -[] > and-neg-bytes-as-number-with-leading-zeroes +[] > tests-and-neg-bytes-as-number-with-leading-zeroes eq. > @ (00-00-00-00-8E-EA-4C-B1.and FF-FF-FF-FF-00-00-00-00).as-number 0 # This unit test is supposed to check the functionality of the corresponding object. # (2397719729.xor -4294967296).eq -1897247567 -[] > xor-neg-bytes-with-leading-zeroes +[] > tests-xor-neg-bytes-with-leading-zeroes eq. > @ 00-00-00-00-8E-EA-4C-B1.xor FF-FF-FF-FF-00-00-00-00 FF-FF-FF-FF-8E-EA-4C-B1 # This unit test is supposed to check the functionality of the corresponding object. # (4294967295.or -4294967296).eq -1 -[] > or-neg-bytes-without-leading-zeroes +[] > tests-or-neg-bytes-without-leading-zeroes eq. > @ 00-00-00-00-FF-FF-FF-FF.or FF-FF-FF-FF-00-00-00-00 FF-FF-FF-FF-FF-FF-FF-FF # This unit test is supposed to check the functionality of the corresponding object. # (4294967295.and -4294967296).eq 0 -[] > and-neg-bytes-as-number-without-leading-zeroes +[] > tests-and-neg-bytes-as-number-without-leading-zeroes eq. > @ (00-00-00-00-FF-FF-FF-FF.and FF-FF-FF-FF-00-00-00-00).as-number 0 # This unit test is supposed to check the functionality of the corresponding object. # (4294967295.xor -4294967296).eq -1 -[] > xor-neg-bytes-as-number-without-leading-zeroes +[] > tests-xor-neg-bytes-as-number-without-leading-zeroes eq. > @ (00-00-00-00-FF-FF-FF-FF.xor FF-FF-FF-FF-00-00-00-00).as-number FF-FF-FF-FF-FF-FF-FF-FF # This unit test is supposed to check the functionality of the corresponding object. -[] > or-neg-bytes-as-number-with-zero +[] > tests-or-neg-bytes-as-number-with-zero eq. > @ (-4294967296.as-bytes.or 0.as-bytes).as-number -4294967296 # This unit test is supposed to check the functionality of the corresponding object. # (-4294967296L.or 1).eq -4294967295L -[] > or-neg-bytes-with-one +[] > tests-or-neg-bytes-with-one eq. > @ FF-FF-FF-FF-00-00-00-00.or 00-00-00-00-00-00-00-01 FF-FF-FF-FF-00-00-00-01 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-bytes-of-wrong-size-as-number +[] > tests-throws-on-bytes-of-wrong-size-as-number 01-01-01-01.as-number > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-bytes-of-wrong-size-as-i64 +[] > tests-throws-on-bytes-of-wrong-size-as-i64 01-01-01-01.as-i64 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > bytes-converts-to-i64 +[] > tests-bytes-converts-to-i64 eq. > @ 00-00-00-00-00-00-00-2A.as-i64 42.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > bytes-converts-to-i64-and-back +[] > tests-bytes-converts-to-i64-and-back eq. > @ 00-00-00-00-00-00-00-33.as-i64.as-bytes 00-00-00-00-00-00-00-33 # This unit test is supposed to check the functionality of the corresponding object. -[] > bytes-as-i64-as-bytes-not-eq-to-number-as-bytes +[] > tests-bytes-as-i64-as-bytes-not-eq-to-number-as-bytes not. > @ eq. 00-00-00-00-00-00-00-2A.as-i64.as-bytes diff --git a/eo-runtime/src/test/eo/org/eolang/cti-test.eo b/eo-runtime/src/test/eo/org/eolang/cti-test.eo index 35c9645130..2948c565c4 100644 --- a/eo-runtime/src/test/eo/org/eolang/cti-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/cti-test.eo @@ -27,7 +27,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > just-prints-warning +[] > tests-tests-just-prints-warning eq. > @ cti 2.times 2 diff --git a/eo-runtime/src/test/eo/org/eolang/dataized-tests.eo b/eo-runtime/src/test/eo/org/eolang/dataized-tests.eo index d252d8a398..0bf8054b8b 100644 --- a/eo-runtime/src/test/eo/org/eolang/dataized-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/dataized-tests.eo @@ -27,7 +27,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > dataized-does-not-do-recalculation +[] > tests-dataized-does-not-do-recalculation eq. > @ malloc.for 0 @@ -44,7 +44,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > dataizes-as-bytes-behaves-as-exclamationed +[] > tests-dataizes-as-bytes-behaves-as-exclamationed # Func. [] > func malloc.for > @ diff --git a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo index 1d27ff2f3b..530c876c5e 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo @@ -29,19 +29,19 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > bound-tmpfile-does-not-recreates-file +[] > tests-bound-tmpfile-does-not-recreates-file tmpdir.tmpfile.as-file > f f.path.eq f.path > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-new-directory +[] > tests-makes-new-directory (tmpdir.tmpfile.deleted.as-path.resolved "foo-new").as-dir.made > d and. > @ d.exists d.is-directory # This unit test is supposed to check the functionality of the corresponding object. -[] > deletes-empty-directory +[] > tests-deletes-empty-directory tmpdir .tmpfile .deleted @@ -55,13 +55,13 @@ .not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-opening-directory +[] > tests-throws-on-opening-directory tmpdir.open > @ "w" true > [d] # This unit test is supposed to check the functionality of the corresponding object. -[] > deletes-directory-with-files-recursively +[] > tests-deletes-directory-with-files-recursively (dir tmpdir.tmpfile.deleted).made > d d.tmpfile > first d.tmpfile > second @@ -76,7 +76,7 @@ second.exists.not # This unit test is supposed to check the functionality of the corresponding object. -[] > deletes-directory-with-file-and-dir +[] > tests-deletes-directory-with-file-and-dir (dir tmpdir.tmpfile.deleted).made > d (dir d.tmpfile.deleted).made > inner d.tmpfile > f @@ -93,7 +93,7 @@ f.exists.not # This unit test is supposed to check the functionality of the corresponding object. -[] > walks-recursively +[] > tests-walks-recursively (dir tmpdir.tmpfile.deleted).made.as-path > d seq > @ * diff --git a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo index 39668ce60b..43434d144e 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo @@ -33,49 +33,49 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > check-if-current-directory-is-directory +[] > tests-check-if-current-directory-is-directory (file ".").is-directory > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > check-if-absent-file-does-not-exist +[] > tests-check-if-absent-file-does-not-exist (file "absent.txt").exists.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-self-after-deleting +[] > tests-returns-self-after-deleting tmpdir.tmpfile > temp temp.deleted.path.eq temp.path > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-self-after-touching +[] > tests-returns-self-after-touching tmpdir.tmpfile > temp temp.deleted.touched.path.eq temp.path > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-file-does-not-exist-after-deleting +[] > tests-checks-file-does-not-exist-after-deleting tmpdir.tmpfile.deleted.exists.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > touches-a-file +[] > tests-touches-a-file tmpdir.tmpfile.deleted.touched.exists > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > measures-empty-file-after-touching +[] > tests-measures-empty-file-after-touching tmpdir.tmpfile.deleted.touched.size.eq 0 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-fail-on-double-touching +[] > tests-does-not-fail-on-double-touching tmpdir.tmpfile.deleted.touched.touched.exists > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-fail-on-double-deleting +[] > tests-does-not-fail-on-double-deleting tmpdir.tmpfile.deleted.deleted.exists.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-an-error-on-touching-temp-file-in-absent-dir +[] > tests-throws-an-error-on-touching-temp-file-in-absent-dir (tmpdir.as-path.resolved "foo").as-dir.tmpfile > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-and-touches +[] > tests-resolves-and-touches (tmpdir.as-path.resolved "foo/bar").as-dir > resolved resolved.tmpfile > f seq > @ @@ -90,7 +90,7 @@ * "foo" "bar" # This unit test is supposed to check the functionality of the corresponding object. -[] > moves-a-file +[] > tests-moves-a-file tmpdir.tmpfile > temp sprintf > dest "%s.dest" @@ -100,7 +100,7 @@ temp.exists.not # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-opening-with-wrong-mode +[] > tests-throws-on-opening-with-wrong-mode tmpdir .tmpfile .open > @ @@ -108,7 +108,7 @@ f > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-reading-from-not-existed-file +[] > tests-throws-on-reading-from-not-existed-file tmpdir .tmpfile .deleted @@ -117,7 +117,7 @@ f > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-reading-or-writing-from-not-existed-file +[] > tests-throws-on-reading-or-writing-from-not-existed-file tmpdir .tmpfile .deleted @@ -126,7 +126,7 @@ f > [f] # Test -[] > touches-absent-file-on-opening-for-writing +[] > tests-touches-absent-file-on-opening-for-writing tmpdir .tmpfile .deleted @@ -136,7 +136,7 @@ .exists > @ # Test -[] > touches-absent-file-on-opening-for-appending +[] > tests-touches-absent-file-on-opening-for-appending tmpdir .tmpfile .deleted @@ -146,7 +146,7 @@ .exists > @ # Test -[] > touches-absent-file-on-opening-for-writing-or-reading +[] > tests-touches-absent-file-on-opening-for-writing-or-reading tmpdir .tmpfile .deleted @@ -156,7 +156,7 @@ .exists > @ # Test -[] > touches-absent-file-on-opening-for-reading-or-appending +[] > tests-touches-absent-file-on-opening-for-reading-or-appending tmpdir .tmpfile .deleted @@ -166,7 +166,7 @@ .exists > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > writes-data-to-file +[] > tests-writes-data-to-file tmpdir .tmpfile .open @@ -176,7 +176,7 @@ .eq 12 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > appending-data-to-file +[] > tests-appending-data-to-file tmpdir .tmpfile .open @@ -189,7 +189,7 @@ .eq 13 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > truncates-file-opened-for-writing +[] > tests-truncates-file-opened-for-writing tmpdir .tmpfile .open @@ -202,7 +202,7 @@ .eq 0 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > truncates-file-opened-for-writing-or-reading +[] > tests-truncates-file-opened-for-writing-or-reading tmpdir .tmpfile .open @@ -215,7 +215,7 @@ .eq 0 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-truncate-file-opened-for-appending +[] > tests-does-not-truncate-file-opened-for-appending tmpdir .tmpfile .open @@ -228,7 +228,7 @@ .eq 12 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-truncate-file-opened-for-reading-or-appending +[] > tests-does-not-truncate-file-opened-for-reading-or-appending tmpdir .tmpfile .open @@ -241,7 +241,7 @@ .eq 12 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-truncate-file-opened-for-reading +[] > tests-does-not-truncate-file-opened-for-reading tmpdir .tmpfile .open @@ -254,7 +254,7 @@ .eq 12 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-writing-with-wrong-mode +[] > tests-throws-on-writing-with-wrong-mode tmpdir .tmpfile .open > @ @@ -262,7 +262,7 @@ f.write "Hello" > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-file +[] > tests-reads-from-file malloc .of 12 @@ -283,7 +283,7 @@ .eq "Hello, world" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-reading-from-file-with-wrong-mode +[] > tests-throws-on-reading-from-file-with-wrong-mode tmpdir .tmpfile .open > @ @@ -291,7 +291,7 @@ f.read 12 > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-file-from-different-instances +[] > tests-reads-from-file-from-different-instances tmpdir.tmpfile > temp temp.path > src seq > @ @@ -317,7 +317,7 @@ .eq "Shrek is love" # This unit test is supposed to check the functionality of the corresponding object. -[] > writes-to-file-from-different-instances +[] > tests-writes-to-file-from-different-instances tmpdir.tmpfile > temp temp.path > src seq > @ @@ -346,7 +346,7 @@ .eq "Shrek is love!" # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-file-sequentially +[] > tests-reads-from-file-sequentially malloc .of 5 @@ -368,7 +368,7 @@ .eq "world" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > writes-to-file-sequentially +[] > tests-writes-to-file-sequentially tmpdir .tmpfile .open diff --git a/eo-runtime/src/test/eo/org/eolang/fs/path-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/path-tests.eo index 1357f11b32..3786a6adf8 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/path-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/path-tests.eo @@ -29,7 +29,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > determines-separator-depending-on-os +[] > tests-determines-separator-depending-on-os eq. > @ path.separator if. @@ -38,13 +38,13 @@ path.posix.separator # This unit test is supposed to check the functionality of the corresponding object. -[] > detects-absolute-posix-path +[] > tests-detects-absolute-posix-path and. > @ (path.posix "/var/www/html").is-absolute (path.posix "foo/bar/baz").is-absolute.not # This unit test is supposed to check the functionality of the corresponding object. -[] > detects-absolute-win32-path +[] > tests-detects-absolute-win32-path and. > @ and. (path.win32 "C:\\Windows\\Users").is-absolute @@ -52,151 +52,151 @@ (path.win32 "temp\\var").is-absolute.not # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-posix-path +[] > tests-normalizes-posix-path eq. > @ (path.posix "/foo/bar/.//./baz//../x/").normalized "/foo/bar/x/" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-posix-relative-path +[] > tests-normalizes-posix-relative-path eq. > @ (path.posix "../../foo/./bar/../x/../y").normalized "../../foo/y" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-empty-posix-path-to-current-dir +[] > tests-normalizes-empty-posix-path-to-current-dir eq. > @ (path.posix "").normalized "." # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-path-to-root +[] > tests-normalizes-path-to-root eq. > @ (path.posix "/foo/bar/baz/../../../../").normalized "/" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-absolute-win32-path-without-drive +[] > tests-normalizes-absolute-win32-path-without-drive eq. > @ (path.win32 "\\Windows\\Users\\..\\App\\\\.\\Local\\\\").normalized "\\Windows\\App\\Local\\" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-absolute-win32-path-with-drive +[] > tests-normalizes-absolute-win32-path-with-drive eq. > @ (path.win32 "C:\\Windows\\\\..\\Users\\.\\AppLocal").normalized "C:\\Users\\AppLocal" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-relative-win32-path +[] > tests-normalizes-relative-win32-path eq. > @ (path.win32 "..\\..\\foo\\bar\\..\\x\\y\\\\").normalized "..\\..\\foo\\x\\y\\" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-empty-win32-driveless-path-to-current-dir +[] > tests-normalizes-empty-win32-driveless-path-to-current-dir eq. > @ (path.win32 "").normalized "." # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-win32-path-down-to-drive-with-separator +[] > tests-normalizes-win32-path-down-to-drive-with-separator eq. > @ (path.win32 "C:\\Windows\\..").normalized "C:\\" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-win32-path-down-to-drive-without-separator +[] > tests-normalizes-win32-path-down-to-drive-without-separator eq. > @ (path.win32 "C:hello\\..").normalized "C:" # This unit test is supposed to check the functionality of the corresponding object. -[] > normalizes-win32-path-with-replacing-slashes +[] > tests-normalizes-win32-path-with-replacing-slashes eq. > @ (path.win32 "/var/www/../html/").normalized "\\var\\html\\" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-posix-absolute-path-against-other-absolute-path +[] > tests-resolves-posix-absolute-path-against-other-absolute-path eq. > @ (path.posix "/var/temp").resolved "/www/html" "/www/html" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-posix-absolute-path-against-other-relative-path +[] > tests-resolves-posix-absolute-path-against-other-relative-path eq. > @ (path.posix "/var/temp").resolved "./www/html" "/var/temp/www/html" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-posix-relative-path-against-other-absolute-path +[] > tests-resolves-posix-relative-path-against-other-absolute-path eq. > @ (path.posix "./var/temp").resolved "/www/html" "/www/html" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-posix-relative-path-against-other-relative-path +[] > tests-resolves-posix-relative-path-against-other-relative-path eq. > @ (path.posix "./var/temp").resolved "../www/html" "var/www/html" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-relative-path-against-other-relative-path +[] > tests-resolves-win32-relative-path-against-other-relative-path eq. > @ (path.win32 ".\\temp\\var").resolved ".\\..\\x" "temp\\x" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-relative-path-against-other-drive-relative-path +[] > tests-resolves-win32-relative-path-against-other-drive-relative-path eq. > @ (path.win32 ".\\temp\\var").resolved "C:\\Windows\\Users" "C:\\Windows\\Users" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-relative-path-against-other-root-relative-path +[] > tests-resolves-win32-relative-path-against-other-root-relative-path eq. > @ (path.win32 ".\\temp\\var").resolved "\\Windows\\Users" "\\Windows\\Users" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-drive-relative-path-against-other-relative-path +[] > tests-resolves-win32-drive-relative-path-against-other-relative-path eq. > @ (path.win32 "C:\\users\\local").resolved ".\\var\\temp" "C:\\users\\local\\var\\temp" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-drive-relative-path-against-other-drive-relative-path +[] > tests-resolves-win32-drive-relative-path-against-other-drive-relative-path eq. > @ (path.win32 "C:\\users\\local").resolved "D:\\local\\var" "D:\\local\\var" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-drive-relative-path-against-other-root-relative-path +[] > tests-resolves-win32-drive-relative-path-against-other-root-relative-path eq. > @ (path.win32 "C:\\users\\local").resolved "\\local\\var" "C:\\local\\var" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-root-relative-path-against-other-relative-path +[] > tests-resolves-win32-root-relative-path-against-other-relative-path eq. > @ (path.win32 "\\users\\local").resolved ".\\hello\\var" "\\users\\local\\hello\\var" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-root-relative-path-against-other-drive-relative-path +[] > tests-resolves-win32-root-relative-path-against-other-drive-relative-path eq. > @ (path.win32 "\\users\\local").resolved "D:\\hello\\var" "D:\\hello\\var" # This unit test is supposed to check the functionality of the corresponding object. -[] > resolves-win32-root-relative-path-against-other-root-relative-path +[] > tests-resolves-win32-root-relative-path-against-other-root-relative-path eq. > @ (path.win32 "\\users\\local").resolved "\\hello\\var" "\\hello\\var" # This unit test is supposed to check the functionality of the corresponding object. -[] > takes-valid-basename +[] > tests-takes-valid-basename eq. > @ basename. path.joined @@ -204,7 +204,7 @@ "hello.eo" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-empty-basename-from-path-ended-with-separator +[] > tests-returns-empty-basename-from-path-ended-with-separator eq. > @ basename. path.joined @@ -212,19 +212,19 @@ "" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-base-with-backslash-in-path-on-posix +[] > tests-returns-base-with-backslash-in-path-on-posix eq. > @ (path.posix "/var/www/html/foo\\bar").basename "foo\\bar" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-the-same-string-if-no-separator-is-found +[] > tests-returns-the-same-string-if-no-separator-is-found eq. > @ (path "Somebody").basename "Somebody" # This unit test is supposed to check the functionality of the corresponding object. -[] > takes-file-extname +[] > tests-takes-file-extname eq. > @ extname. path.joined @@ -232,7 +232,7 @@ ".txt" # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-take-extname-on-file-without-extension +[] > tests-does-not-take-extname-on-file-without-extension eq. > @ extname. path.joined @@ -240,7 +240,7 @@ "" # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-take-extname-if-ends-with-separator +[] > tests-does-not-take-extname-if-ends-with-separator eq. > @ extname. path.joined @@ -248,7 +248,7 @@ "" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-dirname-from-file-path +[] > tests-returns-valid-dirname-from-file-path eq. > @ dirname. path.joined @@ -257,7 +257,7 @@ * "var" "www" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-dirname-from-dir-path +[] > tests-returns-valid-dirname-from-dir-path eq. > @ dirname. path.joined @@ -266,7 +266,7 @@ * "var" "www" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-dirname-from-file-path-without-extension +[] > tests-returns-valid-dirname-from-file-path-without-extension eq. > @ dirname. path.joined diff --git a/eo-runtime/src/test/eo/org/eolang/go-tests.eo b/eo-runtime/src/test/eo/org/eolang/go-tests.eo index 119dbeb711..646141a857 100644 --- a/eo-runtime/src/test/eo/org/eolang/go-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/go-tests.eo @@ -28,7 +28,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > goto-jumps-backwards +[] > tests-goto-jumps-backwards eq. > @ malloc.of 8 @@ -49,7 +49,7 @@ 10 # This unit test is supposed to check the functionality of the corresponding object. -[] > goto-jumps-forward +[] > tests-goto-jumps-forward [x] > div malloc.for > @ 0 @@ -72,7 +72,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-from-method-body +[] > tests-returns-from-method-body [a b] > max go.to > @ [g] >> @@ -88,7 +88,7 @@ 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > nested-goto +[] > tests-nested-goto eq. > @ go.to [g1] diff --git a/eo-runtime/src/test/eo/org/eolang/i16-tests.eo b/eo-runtime/src/test/eo/org/eolang/i16-tests.eo index 2d4b92c918..aca5e7e8b1 100644 --- a/eo-runtime/src/test/eo/org/eolang/i16-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/i16-tests.eo @@ -27,134 +27,134 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-has-valid-bytes +[] > tests-i16-has-valid-bytes eq. > @ 42.as-i64.as-i32.as-i16.as-bytes 00-2A # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-i16-has-valid-bytes +[] > tests-negative-i16-has-valid-bytes eq. > @ -200.as-i64.as-i32.as-i16.as-bytes FF-38 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-less-true +[] > tests-i16-less-true lt. > @ 10.as-i64.as-i32.as-i16 50.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-less-equal +[] > tests-i16-less-equal not. > @ lt. 10.as-i64.as-i32.as-i16 10.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-less-false +[] > tests-i16-less-false not. > @ lt. 10.as-i64.as-i32.as-i16 -5.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-greater-true +[] > tests-i16-greater-true gt. > @ -200.as-i64.as-i32.as-i16 -1000.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-greater-false +[] > tests-i16-greater-false not. > @ gt. 0.as-i64.as-i32.as-i16 100.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-greater-equal +[] > tests-i16-greater-equal not. > @ gt. 0.as-i64.as-i32.as-i16 0.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-lte-true +[] > tests-i16-lte-true lte. > @ -200.as-i64.as-i32.as-i16 -100.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-lte-equal +[] > tests-i16-lte-equal lte. > @ 50.as-i64.as-i32.as-i16 50.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-lte-false +[] > tests-i16-lte-false not. > @ lte. 0.as-i64.as-i32.as-i16 -10.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-gte-true +[] > tests-i16-gte-true gte. > @ -1000.as-i64.as-i32.as-i16 -1100.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-gte-equal +[] > tests-i16-gte-equal gte. > @ 113.as-i64.as-i32.as-i16 113.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-gte-false +[] > tests-i16-gte-false not. > @ gte. 0.as-i64.as-i32.as-i16 10.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-zero-eq-to-i16-zero +[] > tests-i16-zero-eq-to-i16-zero eq. > @ 0.as-i64.as-i32.as-i16 0.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-eq-true +[] > tests-i16-eq-true eq. > @ 123.as-i64.as-i32.as-i16 123.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-eq-false +[] > tests-i16-eq-false not. > @ eq. 123.as-i64.as-i32.as-i16 42.as-i64.as-i32.as-i16 # Test -[] > i16-one-plus-i16-one +[] > tests-i16-one-plus-i16-one eq. > @ 1.as-i64.as-i32.as-i16.plus 1.as-i64.as-i32.as-i16 2.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-plus-with-overflow +[] > tests-i16-plus-with-overflow eq. > @ 32767.as-i64.as-i32.as-i16.plus 1.as-i64.as-i32.as-i16 -32768.as-i64.as-i32.as-i16 # Test -[] > i16-one-minus-i16-one +[] > tests-i16-one-minus-i16-one eq. > @ 1.as-i64.as-i32.as-i16.minus 1.as-i64.as-i32.as-i16 0.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-minus-with-overflow +[] > tests-i16-minus-with-overflow eq. > @ -32768.as-i64.as-i32.as-i16.minus 1.as-i64.as-i32.as-i16 32767.as-i64.as-i32.as-i16 @@ -164,7 +164,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks that division by one returns the dividend. -[] > i16-div-by-i16-one +[] > tests-i16-div-by-i16-one -235.as-i64.as-i32.as-i16 > dividend eq. > @ dividend.div 1.as-i64.as-i32.as-i16 @@ -172,25 +172,25 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks div with remainder -[] > i16-div-with-remainder +[] > tests-i16-div-with-remainder eq. > @ 13.as-i64.as-i32.as-i16.div -5.as-i64.as-i32.as-i16 -2.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-div-less-than-i16-one +[] > tests-i16-div-less-than-i16-one lt. > @ 1.as-i64.as-i32.as-i16.div 5.as-i64.as-i32.as-i16 1.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-multiply-by-zero +[] > tests-i16-multiply-by-zero eq. > @ 1000.as-i64.as-i32.as-i16.times 0.as-i64.as-i32.as-i16 0.as-i64.as-i32.as-i16 # This unit test is supposed to check the functionality of the corresponding object. -[] > i16-times-with-overflow +[] > tests-i16-times-with-overflow eq. > @ 32767.as-i64.as-i32.as-i16.times 2.as-i64.as-i32.as-i16 -2.as-i64.as-i32.as-i16 diff --git a/eo-runtime/src/test/eo/org/eolang/i32-tests.eo b/eo-runtime/src/test/eo/org/eolang/i32-tests.eo index 3fcc5b66b9..62bbb96517 100644 --- a/eo-runtime/src/test/eo/org/eolang/i32-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/i32-tests.eo @@ -27,146 +27,146 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-has-valid-bytes +[] > tests-i32-has-valid-bytes eq. > @ 42.as-i64.as-i32.as-bytes 00-00-00-2A # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-i32-has-valid-bytes +[] > tests-negative-i32-has-valid-bytes eq. > @ -200.as-i64.as-i32.as-bytes FF-FF-FF-38 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-to-i16-and-back +[] > tests-i32-to-i16-and-back eq. > @ 123.as-i64.as-i32 123.as-i64.as-i32.as-i16.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-i32-to-i16-and-back +[] > tests-negative-i32-to-i16-and-back eq. > @ -123.as-i64.as-i32 -123.as-i64.as-i32.as-i16.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-less-true +[] > tests-i32-less-true lt. > @ 10.as-i64.as-i32 50.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-less-equal +[] > tests-i32-less-equal not. > @ lt. 10.as-i64.as-i32 10.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-less-false +[] > tests-i32-less-false not. > @ lt. 10.as-i64.as-i32 -5.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-greater-true +[] > tests-i32-greater-true gt. > @ -200.as-i64.as-i32 -1000.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-greater-false +[] > tests-i32-greater-false not. > @ gt. 0.as-i64.as-i32 100.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-greater-equal +[] > tests-i32-greater-equal not. > @ gt. 0.as-i64.as-i32 0.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-lte-true +[] > tests-i32-lte-true lte. > @ -200.as-i64.as-i32 -100.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-lte-equal +[] > tests-i32-lte-equal lte. > @ 50.as-i64.as-i32 50.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-lte-false +[] > tests-i32-lte-false not. > @ lte. 0.as-i64.as-i32 -10.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-gte-true +[] > tests-i32-gte-true gte. > @ -1000.as-i64.as-i32 -1100.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-gte-equal +[] > tests-i32-gte-equal gte. > @ 113.as-i64.as-i32 113.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-gte-false +[] > tests-i32-gte-false not. > @ gte. 0.as-i64.as-i32 10.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-zero-eq-to-i32-zero +[] > tests-i32-zero-eq-to-i32-zero eq. > @ 0.as-i64.as-i32 0.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-eq-true +[] > tests-i32-eq-true eq. > @ 123.as-i64.as-i32 123.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-eq-false +[] > tests-i32-eq-false not. > @ eq. 123.as-i64.as-i32 42.as-i64.as-i32 # Test -[] > i32-one-plus-i32-one +[] > tests-i32-one-plus-i32-one eq. > @ 1.as-i64.as-i32.plus 1.as-i64.as-i32 2.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-plus-with-overflow +[] > tests-i32-plus-with-overflow eq. > @ 2147483647.as-i64.as-i32.plus 1.as-i64.as-i32 -2147483648.as-i64.as-i32 # Test -[] > i32-one-minus-i32-one +[] > tests-i32-one-minus-i32-one eq. > @ 1.as-i64.as-i32.minus 1.as-i64.as-i32 0.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-minus-with-overflow +[] > tests-i32-minus-with-overflow eq. > @ -2147483648.as-i64.as-i32.minus 1.as-i64.as-i32 2147483647.as-i64.as-i32 @@ -179,7 +179,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks that division by one returns the dividend. -[] > i32-div-by-i32-one +[] > tests-i32-div-by-i32-one -235.as-i64.as-i32 > dividend eq. > @ dividend.div 1.as-i64.as-i32 @@ -187,25 +187,25 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks div with remainder -[] > i32-div-with-remainder +[] > tests-i32-div-with-remainder eq. > @ 13.as-i64.as-i32.div -5.as-i64.as-i32 -2.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-div-less-than-i32-one +[] > tests-i32-div-less-than-i32-one lt. > @ 1.as-i64.as-i32.div 5.as-i64.as-i32 1.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-multiply-by-zero +[] > tests-i32-multiply-by-zero eq. > @ 1000.as-i64.as-i32.times 0.as-i64.as-i32 0.as-i64.as-i32 # This unit test is supposed to check the functionality of the corresponding object. -[] > i32-times-with-overflow +[] > tests-i32-times-with-overflow eq. > @ 2147483647.as-i64.as-i32.times 2.as-i64.as-i32 -2.as-i64.as-i32 diff --git a/eo-runtime/src/test/eo/org/eolang/i64-tests.eo b/eo-runtime/src/test/eo/org/eolang/i64-tests.eo index eebc370c7f..8e78a93cb8 100644 --- a/eo-runtime/src/test/eo/org/eolang/i64-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/i64-tests.eo @@ -27,26 +27,26 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-has-valid-bytes +[] > tests-i64-has-valid-bytes eq. > @ 42.as-i64.as-bytes 00-00-00-00-00-00-00-2A # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-as-bytes-is-not-equal-to-number-bytes +[] > tests-i64-as-bytes-is-not-equal-to-number-bytes not. > @ eq. i64 234.as-bytes 234.as-i64.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-to-i32-and-back +[] > tests-i64-to-i32-and-back eq. > @ 234.as-i64 234.as-i64.as-i32.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-i64-to-i32-and-back +[] > tests-negative-i64-to-i32-and-back eq. > @ -234.as-i64 -234.as-i64.as-i32.as-i64 @@ -55,110 +55,110 @@ 3147483647.as-i64.as-i32 > [] > throws-on-converting-to-i32-if-out-of-bounds # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-less-true +[] > tests-i64-less-true lt. > @ 10.as-i64 50.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-less-equal +[] > tests-i64-less-equal not. > @ lt. 10.as-i64 10.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-less-false +[] > tests-i64-less-false not. > @ lt. 10.as-i64 -5.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-greater-true +[] > tests-i64-greater-true gt. > @ -200.as-i64 -1000.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-greater-false +[] > tests-i64-greater-false not. > @ gt. 0.as-i64 100.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-greater-equal +[] > tests-i64-greater-equal not. > @ gt. 0.as-i64 0.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-lte-true +[] > tests-i64-lte-true lte. > @ -200.as-i64 -100.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-lte-equal +[] > tests-i64-lte-equal lte. > @ 50.as-i64 50.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-lte-false +[] > tests-i64-lte-false not. > @ lte. 0.as-i64 -10.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-gte-true +[] > tests-i64-gte-true gte. > @ -1000.as-i64 -1100.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-gte-equal +[] > tests-i64-gte-equal gte. > @ 113.as-i64 113.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-gte-false +[] > tests-i64-gte-false not. > @ gte. 0.as-i64 10.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-zero-eq-to-i64-zero +[] > tests-i64-zero-eq-to-i64-zero eq. > @ 0.as-i64 0.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-eq-true +[] > tests-i64-eq-true eq. > @ 123.as-i64 123.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-eq-false +[] > tests-i64-eq-false not. > @ eq. 123.as-i64 42.as-i64 # Test -[] > i64-one-plus-i64-one +[] > tests-i64-one-plus-i64-one eq. > @ 1.as-i64.plus 1.as-i64 2.as-i64 # Test -[] > i64-one-minus-i64-one +[] > tests-i64-one-minus-i64-one eq. > @ 1.as-i64.minus 1.as-i64 0.as-i64 @@ -167,26 +167,26 @@ 2.as-i64.div 0.as-i64 > [] > throws-on-division-i64-by-i64-zero # Checks that division by one returns the dividend. -[] > i64-div-by-i64-one +[] > tests-i64-div-by-i64-one -235.as-i64 > dividend eq. > @ dividend.div 1.as-i64 dividend # Checks div with remainder -[] > i64-div-with-remainder +[] > tests-i64-div-with-remainder eq. > @ 13.as-i64.div -5.as-i64 -2.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-div-less-than-i64-one +[] > tests-i64-div-less-than-i64-one lt. > @ 1.as-i64.div 5.as-i64 1.as-i64 # This unit test is supposed to check the functionality of the corresponding object. -[] > i64-multiply-by-zero +[] > tests-i64-multiply-by-zero eq. > @ 1000.as-i64.times 0.as-i64 0.as-i64 diff --git a/eo-runtime/src/test/eo/org/eolang/io/bytes-as-input-test.eo b/eo-runtime/src/test/eo/org/eolang/io/bytes-as-input-test.eo index b5687581f6..ba6feec91e 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/bytes-as-input-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/bytes-as-input-test.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-an-input-from-bytes-and-reads +[] > tests-makes-an-input-from-bytes-and-reads bytes-as-input > i 01-02-03-04-05-06-07-08-F5-F6 i.read 4 > i1 diff --git a/eo-runtime/src/test/eo/org/eolang/io/console-test.eo b/eo-runtime/src/test/eo/org/eolang/io/console-test.eo index 5f5a3a611a..24d7b85d61 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/console-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/console-test.eo @@ -29,6 +29,6 @@ # Prints a simple message to the console. We can't validate # the output, so we just run it and see if it crashes. -[] > writes-to-console +[] > tests-writes-to-console console.write > @ "Hello, console-test!\n" diff --git a/eo-runtime/src/test/eo/org/eolang/io/dead-input-tests.eo b/eo-runtime/src/test/eo/org/eolang/io/dead-input-tests.eo index 580ae10171..0c1b0570c1 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/dead-input-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/dead-input-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-empty-bytes +[] > tests-reads-empty-bytes dead-input.read 10 > i1 i1.read 10 > i2 and. > @ diff --git a/eo-runtime/src/test/eo/org/eolang/io/input-length-tests.eo b/eo-runtime/src/test/eo/org/eolang/io/input-length-tests.eo index bf4979b131..5c99bf9218 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/input-length-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/input-length-tests.eo @@ -31,7 +31,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-all-bytes-and-returns-length +[] > tests-reads-all-bytes-and-returns-length eq. > @ input-length bytes-as-input @@ -39,7 +39,7 @@ 10 # This unit test is supposed to check the functionality of the corresponding object. -[] > copies-all-bytes-to-output-and-returns-length +[] > tests-copies-all-bytes-to-output-and-returns-length eq. > @ malloc.of 10 diff --git a/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo b/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo index ea9fafdfd7..4c92889348 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-an-output-from-malloc-and-writes +[] > tests-makes-an-output-from-malloc-and-writes eq. > @ malloc.of 10 @@ -43,7 +43,7 @@ 01-02-03-04-05-06-07-08-09-A0 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-writing-more-than-allocated +[] > tests-throws-on-writing-more-than-allocated malloc.of > @ 2 [m] diff --git a/eo-runtime/src/test/eo/org/eolang/io/stdout-test.eo b/eo-runtime/src/test/eo/org/eolang/io/stdout-test.eo index 9ddf518a39..9083e04a8c 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/stdout-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/stdout-test.eo @@ -29,6 +29,6 @@ # Prints a simple message to the console. We can't validate # the output, so we just run it and see if it crashes. -[] > prints-to-console +[] > tests-prints-to-console stdout > @ "Hello, stdout-test!\n" diff --git a/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo b/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo index ca9866307d..39bad457e6 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/tee-input-tests.eo @@ -31,7 +31,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-bytes-and-writes-to-memory +[] > tests-reads-from-bytes-and-writes-to-memory eq. > @ malloc.of 5 @@ -44,7 +44,7 @@ 01-02-03-04-05 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-bytes-and-writes-to-memory-by-portions +[] > tests-reads-from-bytes-and-writes-to-memory-by-portions eq. > @ malloc.of 5 @@ -61,7 +61,7 @@ 01-02-03-04-05 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-from-bytes-and-writes-to-two-memory-blocks +[] > tests-reads-from-bytes-and-writes-to-two-memory-blocks eq. > @ malloc.of 6 diff --git a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo index 92c0fd2540..b77fc54af1 100644 --- a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo @@ -28,7 +28,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > writes-into-memory-of +[] > tests-writes-into-memory-of malloc.of > mem 8 [m] @@ -39,14 +39,14 @@ mem.eq 10 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > puts-into-memory-for +[] > tests-puts-into-memory-for malloc.for > mem 0 m.put 10 > [m] mem.eq 10 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-size-from-scope +[] > tests-returns-size-from-scope eq. > @ malloc.of 5 @@ -54,7 +54,7 @@ 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-scope-is-dataized-twice +[] > tests-malloc-scope-is-dataized-twice eq. > @ 2 malloc.for @@ -69,7 +69,7 @@ second # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-for-writes-first-init-value +[] > tests-malloc-for-writes-first-init-value eq. > @ malloc.for 42 @@ -77,7 +77,7 @@ 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-puts-over-the-previous-data +[] > tests-malloc-puts-over-the-previous-data malloc.of > mem 13 [m] @@ -91,7 +91,7 @@ mem # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-rewrites-and-increments-itself +[] > tests-malloc-rewrites-and-increments-itself malloc.of > mem 8 [m] @@ -102,7 +102,7 @@ mem.eq 6 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > writes-into-two-malloc-objects +[] > tests-writes-into-two-malloc-objects malloc.of > a 8 m.put 10 > [m] @@ -114,19 +114,19 @@ b.eq 20 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-overflow-boolean-malloc +[] > tests-throws-on-overflow-boolean-malloc malloc.for > @ false m.put 86124867.88 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-overflow-string-malloc +[] > tests-throws-on-overflow-string-malloc malloc.for > @ "Hello" m.put "Much longer string!" > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-is-strictly-sized-int +[] > tests-malloc-is-strictly-sized-int eq. > @ malloc.for 12248 @@ -134,7 +134,7 @@ 2556 # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-is-strictly-typed-float +[] > tests-malloc-is-strictly-typed-float eq. > @ malloc.for 245.88 @@ -142,7 +142,7 @@ 82.22 # This unit test is supposed to check the functionality of the corresponding object. -[] > memory-is-strictly-sized-string +[] > tests-memory-is-strictly-sized-string eq. > @ malloc.for "Hello" @@ -150,19 +150,19 @@ "Proto" # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-is-strictly-typed-bool +[] > tests-malloc-is-strictly-typed-bool malloc.for > @ false m.put true > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-gives-id-to-allocated-block +[] > tests-malloc-gives-id-to-allocated-block malloc.of > @ 1 m.put (m.id.gt 0) > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-allocates-right-size-block +[] > tests-malloc-allocates-right-size-block malloc.of > @ 1 [b] @@ -171,7 +171,7 @@ b.put (m.size.eq 10) > [m] >> # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-writes-and-reads +[] > tests-malloc-writes-and-reads malloc.of > @ 1 [b] @@ -188,7 +188,7 @@ "Hello, Jeff!" # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-concacts-strings-with-offset +[] > tests-malloc-concacts-strings-with-offset malloc.of > @ 1 [b] @@ -203,13 +203,13 @@ (m.read 0 3).eq "XYX" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-writing-more-than-allocated-to-malloc-with-offset +[] > tests-throws-on-writing-more-than-allocated-to-malloc-with-offset malloc.of > @ 1 m.write 1 true > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-reads-with-offset-and-length +[] > tests-malloc-reads-with-offset-and-length malloc.of > @ 1 [b] @@ -223,7 +223,7 @@ (m.read 2 5).eq "Hello" # Creates memory block of zero bytes (this should be a legal operation) -[] > allocates-zero-bytes +[] > tests-allocates-zero-bytes eq. > @ 0 malloc.of @@ -231,7 +231,7 @@ m.size > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-increases-block-size +[] > tests-malloc-increases-block-size malloc.of > @ 1 [b] @@ -244,7 +244,7 @@ m.get.eq 01-02-03-04-00-00 # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-decreases-block-size +[] > tests-malloc-decreases-block-size malloc.of > @ 1 [b] @@ -257,18 +257,18 @@ m.get.eq 01-02-03 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-changing-size-to-negative +[] > tests-throws-on-changing-size-to-negative malloc.of > @ 1 m.resized -1 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > malloc-empty-is-empty +[] > tests-malloc-empty-is-empty malloc.empty > @ m.size.eq 0 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > copies-data-inside-itself +[] > tests-copies-data-inside-itself malloc.for > @ 01-02-03-04-05 [m] @@ -277,7 +277,7 @@ m.get.eq 01-02-02-03-05 # This unit test is supposed to check the functionality of the corresponding object. -[] > copies-data-from-start-to-end +[] > tests-copies-data-from-start-to-end malloc.for > @ 01-02-03-04-05-06 [m] @@ -286,19 +286,19 @@ m.get.eq 01-02-03-01-02-03 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-copying-with-wrong-source +[] > tests-throws-on-copying-with-wrong-source malloc.for > @ 0 m.copy 9 1 1 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-copying-with-wrong-target +[] > tests-throws-on-copying-with-wrong-target malloc.for > @ 0 m.copy 3 9 1 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-copying-with-wrong-length +[] > tests-throws-on-copying-with-wrong-length malloc.for > @ 0 m.copy 3 1 9 > [m] diff --git a/eo-runtime/src/test/eo/org/eolang/math/angle-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/angle-tests.eo index 2538392a08..057168e62a 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/angle-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/angle-tests.eo @@ -29,37 +29,37 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > sin-zero +[] > tests-sin-zero eq. > @ (angle 0).sin 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > sin-pi-div-2 +[] > tests-sin-pi-div-2 eq. > @ (angle (pi.div 2)).sin 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > sin-pi-floored +[] > tests-sin-pi-floored eq. > @ (angle pi).sin.floor 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > cos-zero +[] > tests-cos-zero eq. > @ (angle 0).cos 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > cos-pi-div-2-floored +[] > tests-cos-pi-div-2-floored eq. > @ (angle (pi.div 2)).cos.floor 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > cos-pi +[] > tests-cos-pi eq. > @ (angle pi).cos -1 diff --git a/eo-runtime/src/test/eo/org/eolang/math/integral-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/integral-tests.eo index 509274f31e..1adc70ce50 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/integral-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/integral-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-lineal-integral +[] > tests-calculates-lineal-integral as-number. > lineal integral x > [x] @@ -55,7 +55,7 @@ value.neg # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-quadratic-integral +[] > tests-calculates-quadratic-integral as-number. > quadratic integral x.times x > [x] @@ -82,7 +82,7 @@ value.neg # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-cube-integral +[] > tests-calculates-cube-integral as-number. > cube integral (x.times x).times x > [x] diff --git a/eo-runtime/src/test/eo/org/eolang/math/numbers-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/numbers-tests.eo index d5b5813805..bfa6328b30 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/numbers-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/numbers-tests.eo @@ -34,49 +34,49 @@ (numbers *).min > [] > throws-on-taking-min-from-empty-sequence-of-numbers # This unit test is supposed to check the functionality of the corresponding object. -[] > max-of-one-item-array +[] > tests-max-of-one-item-array eq. > @ (numbers (* 42)).max 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > min-of-one-item-array +[] > tests-min-of-one-item-array eq. > @ (numbers (* 42)).min 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > max-of-array-is-first +[] > tests-max-of-array-is-first eq. > @ (numbers (* 25 12 -2)).max 25 # This unit test is supposed to check the functionality of the corresponding object. -[] > max-of-array-is-in-the-center +[] > tests-max-of-array-is-in-the-center eq. > @ (numbers (* 12 25 -2)).max 25 # This unit test is supposed to check the functionality of the corresponding object. -[] > max-of-array-is-last +[] > tests-max-of-array-is-last eq. > @ (numbers (* 12 -2 25)).max 25 # This unit test is supposed to check the functionality of the corresponding object. -[] > min-of-array-is-first +[] > tests-min-of-array-is-first eq. > @ (numbers (* -2 25 12)).min -2 # This unit test is supposed to check the functionality of the corresponding object. -[] > min-of-array-is-in-the-center +[] > tests-min-of-array-is-in-the-center eq. > @ (numbers (* 12 -2 25)).min -2 # This unit test is supposed to check the functionality of the corresponding object. -[] > min-of-array-is-last +[] > tests-min-of-array-is-last eq. > @ (numbers (* 12 25 -2)).min -2 diff --git a/eo-runtime/src/test/eo/org/eolang/math/random-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/random-tests.eo index d3751c9a4f..c6f9450fd4 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/random-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/random-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > random-with-seed +[] > tests-random-with-seed random 51 > r not. > @ eq. @@ -36,13 +36,13 @@ r.next.next # This unit test is supposed to check the functionality of the corresponding object. -[] > seeded-randoms-are-equal +[] > tests-seeded-randoms-are-equal eq. > @ (random 1654).next.next.next (random 1654).next.next.next # This unit test is supposed to check the functionality of the corresponding object. -[] > random-is-in-range +[] > tests-random-is-in-range (random 123).fixed > r and. > @ and. @@ -57,6 +57,6 @@ (r.next.next.lt 0).not # This unit test is supposed to check the functionality of the corresponding object. -[] > two-random-numbers-not-equal +[] > tests-two-random-numbers-not-equal not. > @ random.pseudo.eq random.pseudo diff --git a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo index 738e7d5878..747d7f9a84 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo @@ -30,61 +30,61 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > abs-int-positive +[] > tests-abs-int-positive eq. > @ (real 3).abs 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > abs-int-negative +[] > tests-abs-int-negative eq. > @ (real -3).abs 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > abs-zero +[] > tests-abs-zero eq. > @ (real 0).abs 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > abs-float-positive +[] > tests-abs-float-positive eq. > @ (real 13.5).abs 13.5 # This unit test is supposed to check the functionality of the corresponding object. -[] > abs-float-negative +[] > tests-abs-float-negative eq. > @ (real -17.9).abs 17.9 # This unit test is supposed to check the functionality of the corresponding object. -[] > mod-1-2 +[] > tests-mod-1-2 eq. > @ (real 1).mod 2 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > mod-0-5 +[] > tests-mod-0-5 eq. > @ (real 0).mod 5 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > mod-0-15-neg +[] > tests-mod-0-15-neg eq. > @ (real 0).mod -15 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > mod-1-neg-7 +[] > tests-mod-1-neg-7 eq. > @ (real -1).mod 7 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > mod-16-200-neg +[] > tests-mod-16-200-neg eq. > @ (real 16).mod -200 16 @@ -92,7 +92,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks mathematical equality # A = ((A div B) * B) + (A mod B) -[] > div-mod-compatibility +[] > tests-div-mod-compatibility -13 > dividend 5 > divisor (real dividend).mod divisor > remainder @@ -107,265 +107,265 @@ # This unit test is supposed to check the functionality of the corresponding object. # Checks modulo: dividend < divisor. -[] > mod-dividend-less-than-divisor +[] > tests-mod-dividend-less-than-divisor eq. > @ (real -1).mod 5 -1 # This unit test is supposed to check the functionality of the corresponding object. # Checks modulo by 1. -[] > mod-dividend-by-one +[] > tests-mod-dividend-by-one eq. > @ (real 133).mod 1 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > pow-test +[] > tests-pow-test eq. > @ (real 2).pow 4 16 # This unit test is supposed to check the functionality of the corresponding object. -[] > pow-is-zero +[] > tests-pow-is-zero eq. > @ (real 2).pow 0 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > pow-is-negative +[] > tests-pow-is-negative eq. > @ (real 984782).pow -12341 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > pow-of-two +[] > tests-pow-of-two eq. > @ (real 3).pow 2 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > pow-of-zero +[] > tests-pow-of-zero eq. > @ (real 0).pow 145 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-negative-pow-of-zero +[] > tests-throws-on-negative-pow-of-zero (real 0).pow -567 > @ # This unit test is supposed to check the functionality of the corresponding object. # Check pow works with NaNs. -[] > nan-to-the-pow-of-nan-is-nan +[] > tests-nan-to-the-pow-of-nan-is-nan is-nan. > @ (real nan).pow nan # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-to-the-pow-of-any-is-nan +[] > tests-nan-to-the-pow-of-any-is-nan is-nan. > @ (real nan).pow 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > any-to-the-pow-of-nan-is-nan +[] > tests-any-to-the-pow-of-nan-is-nan is-nan. > @ (real 52).pow nan # This unit test is supposed to check the functionality of the corresponding object. # Check if pow is zero. -[] > any-int-to-the-pow-of-zero-is-one +[] > tests-any-int-to-the-pow-of-zero-is-one eq. > @ (real 42).pow 0 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > any-float-to-the-pow-of-zero-is-one +[] > tests-any-float-to-the-pow-of-zero-is-one eq. > @ (real 42.5).pow 0 1 # This unit test is supposed to check the functionality of the corresponding object. # Check if pow is less than zero -[] > zero-to-the-negative-pow-is-positive-infinity +[] > tests-zero-to-the-negative-pow-is-positive-infinity eq. > @ (real 0).pow -52 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > zero-to-the-negative-infinity-pow-is-positive-infinity +[] > tests-zero-to-the-negative-infinity-pow-is-positive-infinity eq. > @ (real 0).pow negative-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-int-to-the-pow-of-negative-infinity-is-zero +[] > tests-positive-int-to-the-pow-of-negative-infinity-is-zero eq. > @ (real 42).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-float-to-the-pow-of-negative-infinity-is-zero +[] > tests-positive-float-to-the-pow-of-negative-infinity-is-zero eq. > @ (real 42.5).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-int-to-the-pow-of-negative-infinity-is-zero +[] > tests-negative-int-to-the-pow-of-negative-infinity-is-zero eq. > @ (real -42).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-float-to-the-pow-of-negative-infinity-is-zero +[] > tests-negative-float-to-the-pow-of-negative-infinity-is-zero eq. > @ (real -42.5).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-pow-of-negative-infinity-is-zero +[] > tests-positive-infinity-to-the-pow-of-negative-infinity-is-zero eq. > @ (real positive-infinity).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-to-the-pow-of-negative-infinity-is-zero +[] > tests-negative-infinity-to-the-pow-of-negative-infinity-is-zero eq. > @ (real negative-infinity).pow negative-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-finite-negative-int-pow-is-zero +[] > tests-positive-infinity-to-the-finite-negative-int-pow-is-zero eq. > @ (real positive-infinity).pow -42 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-finite-negative-float-pow-is-zero +[] > tests-positive-infinity-to-the-finite-negative-float-pow-is-zero eq. > @ (real positive-infinity).pow -42.2 0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > two-to-the-pow-of-minus-one +[] > tests-two-to-the-pow-of-minus-one eq. > @ (real 2).pow -1 0.5 # This unit test is supposed to check the functionality of the corresponding object. -[] > two-to-the-pow-of-int-minus-two +[] > tests-two-to-the-pow-of-int-minus-two eq. > @ (real 2).pow -2 0.25 # This unit test is supposed to check the functionality of the corresponding object. -[] > two-to-the-pow-of-minus-three +[] > tests-two-to-the-pow-of-minus-three eq. > @ (real 2).pow -3 0.125 # This unit test is supposed to check the functionality of the corresponding object. -[] > four-to-the-pow-of-minus-three +[] > tests-four-to-the-pow-of-minus-three eq. > @ (real 4).pow -3.0 0.015625 # This unit test is supposed to check the functionality of the corresponding object. # Check if pow more than zero. -[] > zero-to-the-pow-of-positive-int-is-zero +[] > tests-zero-to-the-pow-of-positive-int-is-zero eq. > @ (real 0).pow 4 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > zero-to-the-pow-of-positive-float-is-zero +[] > tests-zero-to-the-pow-of-positive-float-is-zero eq. > @ (real 0).pow 4.2 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > zero-to-the-pow-of-positive-infinity-is-zero +[] > tests-zero-to-the-pow-of-positive-infinity-is-zero eq. > @ (real 0).pow positive-infinity 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-int-to-the-pow-of-positive-infinity-is-positive-infinity +[] > tests-negative-int-to-the-pow-of-positive-infinity-is-positive-infinity eq. > @ (real -10).pow positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-float-to-the-pow-of-positive-infinity-is-infinity +[] > tests-negative-float-to-the-pow-of-positive-infinity-is-infinity eq. > @ (real -4.2).pow positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-int-to-the-pow-of-positive-infinity-is-positive-infinity +[] > tests-positive-int-to-the-pow-of-positive-infinity-is-positive-infinity eq. > @ (real 42).pow positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-float-to-the-pow-of-positive-infinity-is-positive-infinity +[] > tests-positive-float-to-the-pow-of-positive-infinity-is-positive-infinity eq. > @ (real 42.5).pow positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-pow-of-positive-int-is-positive-infinity +[] > tests-positive-infinity-to-the-pow-of-positive-int-is-positive-infinity eq. > @ (real positive-infinity).pow 42 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-pow-of-positive-float-is-positive-infinity +[] > tests-positive-infinity-to-the-pow-of-positive-float-is-positive-infinity eq. > @ (real positive-infinity).pow 10.8 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-to-the-pow-of-positive-infinity-is-positive-infinity +[] > tests-positive-infinity-to-the-pow-of-positive-infinity-is-positive-infinity eq. > @ (real positive-infinity).pow positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-to-the-pow-of-positive-float-is-positive-infinity +[] > tests-negative-infinity-to-the-pow-of-positive-float-is-positive-infinity eq. > @ (real negative-infinity).pow 9.9 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-to-the-pow-of-even-positive-int-is-positive-infinity +[] > tests-negative-infinity-to-the-pow-of-even-positive-int-is-positive-infinity eq. > @ (real negative-infinity).pow 10 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-to-the-pow-of-odd-positive-int-is-positive-infinity +[] > tests-negative-infinity-to-the-pow-of-odd-positive-int-is-positive-infinity eq. > @ (real negative-infinity).pow 9 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-int-to-the-pow-of-positive-int-is-int +[] > tests-positive-int-to-the-pow-of-positive-int-is-int eq. > @ (real 2).pow 3 8 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-float-to-the-pow-of-positive-int-is-float +[] > tests-positive-float-to-the-pow-of-positive-int-is-float eq. > @ (real 3.5).pow 4 150.0625 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-int-to-the-pow-of-positive-float-is-float +[] > tests-positive-int-to-the-pow-of-positive-float-is-float eq. > @ (real 4).pow 5 1024 # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-zero-input +[] > tests-sqrt-check-zero-input lt. > @ abs. real @@ -376,13 +376,13 @@ 0.00000000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-negative-input +[] > tests-sqrt-check-negative-input is-nan. > @ sqrt. real -0.1 # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-float-input +[] > tests-sqrt-check-float-input lt. > @ abs. real @@ -394,7 +394,7 @@ 0.00000000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-int-input +[] > tests-sqrt-check-int-input lt. > @ abs. real @@ -406,87 +406,87 @@ 0.00000000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-nan-input +[] > tests-sqrt-check-nan-input is-nan. > @ sqrt. real nan # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-infinity-1 +[] > tests-sqrt-check-infinity-1 eq. > @ sqrt. real positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > sqrt-check-infinity-2 +[] > tests-sqrt-check-infinity-2 is-nan. > @ sqrt. real negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-negative-float-is-nan +[] > tests-ln-of-negative-float-is-nan is-nan. > @ ln. real -2.2 # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-zero-is-negative-infinity +[] > tests-ln-of-zero-is-negative-infinity eq. > @ ln. real 0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-one-is-zero +[] > tests-ln-of-one-is-zero eq. > @ ln. real 1 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-e-one-is-one +[] > tests-ln-of-e-one-is-one eq. > @ ln. real e 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-negative-int-is-nan +[] > tests-ln-of-negative-int-is-nan is-nan. > @ ln. real -42 # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-int-zero-is-negative-infinity +[] > tests-ln-of-int-zero-is-negative-infinity eq. > @ ln. real 0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-int-one-is-zero +[] > tests-ln-of-int-one-is-zero eq. > @ ln. real 1 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > ln-of-twenty +[] > tests-ln-of-twenty eq. > @ ln. real 20 2.995732273553991 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-negative-one-test +[] > tests-arccos-negative-one-test eq. > @ acos. real -1.0 pi # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-zero-test +[] > tests-arccos-zero-test eq. > @ acos. real 0 @@ -495,14 +495,14 @@ 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-one-test +[] > tests-arccos-one-test eq. > @ acos. real 1.0 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-positive-calculated-test +[] > tests-arccos-positive-calculated-test lt. > @ abs. real @@ -513,7 +513,7 @@ 0.000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-negative-calculated-test +[] > tests-arccos-negative-calculated-test lt. > @ abs. real @@ -524,18 +524,18 @@ 0.000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-nan-positive-value-test +[] > tests-arccos-nan-positive-value-test is-nan. > @ acos. real 2.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > arccos-nan-negative-value-test +[] > tests-arccos-nan-negative-value-test is-nan. > @ (real -2.0).acos # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-0 +[] > tests-exp-check-0 lt. > @ abs. real @@ -545,7 +545,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-1 +[] > tests-exp-check-1 lt. > @ abs. real @@ -555,7 +555,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-2 +[] > tests-exp-check-2 lt. > @ abs. real @@ -565,7 +565,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-3 +[] > tests-exp-check-3 lt. > @ abs. real @@ -575,7 +575,7 @@ 0.0000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-4 +[] > tests-exp-check-4 lt. > @ abs. real @@ -585,18 +585,18 @@ 0.000000000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-nan +[] > tests-exp-check-nan is-nan. > @ (real nan).exp # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-infinity-1 +[] > tests-exp-check-infinity-1 eq. > @ (real positive-infinity).exp positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > exp-check-infinity-2 +[] > tests-exp-check-infinity-2 eq. > @ (real negative-infinity).exp 0 diff --git a/eo-runtime/src/test/eo/org/eolang/nan-tests.eo b/eo-runtime/src/test/eo/org/eolang/nan-tests.eo index 9085b22321..01346a793b 100644 --- a/eo-runtime/src/test/eo/org/eolang/nan-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/nan-tests.eo @@ -27,123 +27,123 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-eq-number +[] > tests-nan-not-eq-number not. > @ eq. nan 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-eq-nan +[] > tests-nan-not-eq-nan not. > @ eq. nan nan # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-lt-number +[] > tests-nan-not-lt-number eq. > @ nan.lt 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-lt-nan +[] > tests-nan-not-lt-nan eq. > @ nan.lt nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-lte-number +[] > tests-nan-not-lte-number eq. > @ nan.lte 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-lte-nan +[] > tests-nan-not-lte-nan eq. > @ nan.lte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-gt-number +[] > tests-nan-not-gt-number eq. > @ nan.gt 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-gt-nan +[] > tests-nan-not-gt-nan eq. > @ nan.gt nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-gte-number +[] > tests-nan-not-gte-number eq. > @ nan.gte 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-not-gte-nan +[] > tests-nan-not-gte-nan eq. > @ nan.gte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-times-number-is-nan +[] > tests-nan-times-number-is-nan eq. > @ (nan.times 42).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-times-nan-is-nan +[] > tests-nan-times-nan-is-nan eq. > @ (nan.times nan).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-div-number-is-nan +[] > tests-nan-div-number-is-nan eq. > @ (nan.div 42).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-div-nan-is-nan +[] > tests-nan-div-nan-is-nan eq. > @ (nan.div nan).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-plus-number-is-nan +[] > tests-nan-plus-number-is-nan eq. > @ (nan.plus 42).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-plus-nan-is-nan +[] > tests-nan-plus-nan-is-nan eq. > @ (nan.plus nan).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-neg-is-nan +[] > tests-nan-neg-is-nan eq. > @ nan.neg.as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-minus-number-is-nan +[] > tests-nan-minus-number-is-nan eq. > @ (nan.minus 42).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-minus-nan-is-nan +[] > tests-nan-minus-nan-is-nan eq. > @ (nan.minus nan).as-bytes nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > nan-as-bytes-is-bytes-of-zero-div-zero +[] > tests-nan-as-bytes-is-bytes-of-zero-div-zero eq. > @ nan.as-bytes (0.0.div 0.0).as-bytes diff --git a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo index ba448698ca..c884c42087 100644 --- a/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/negative-infinity-tests.eo @@ -27,417 +27,417 @@ +version 0.0.0 # Equal to. -[] > negative-infinity-is-equal-to-one-div-zero +[] > tests-negative-infinity-is-equal-to-one-div-zero eq. > @ negative-infinity -1.0.div 0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-eq-negative-infinity +[] > tests-negative-infinity-eq-negative-infinity eq. > @ negative-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-eq-positive-infinity +[] > tests-negative-infinity-not-eq-positive-infinity not. > @ eq. negative-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-eq-nan +[] > tests-negative-infinity-not-eq-nan not. > @ eq. negative-infinity nan # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-eq-int +[] > tests-negative-infinity-not-eq-int not. > @ eq. negative-infinity 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-eq-float +[] > tests-negative-infinity-not-eq-float not. > @ eq. negative-infinity 42.5 # Less than. -[] > negative-infinity-lt-negative-infinity +[] > tests-negative-infinity-lt-negative-infinity eq. > @ negative-infinity.lt negative-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lt-positive-infinity +[] > tests-negative-infinity-lt-positive-infinity eq. > @ negative-infinity.lt positive-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-lt-nan +[] > tests-negative-infinity-not-lt-nan eq. > @ negative-infinity.lt nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lt-int +[] > tests-negative-infinity-lt-int lt. > @ negative-infinity 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lt-float +[] > tests-negative-infinity-lt-float lt. > @ negative-infinity 42.5 # Less or equal than. -[] > negative-infinity-lte-negative-infinity +[] > tests-negative-infinity-lte-negative-infinity eq. > @ negative-infinity.lte negative-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lte-positive-infinity +[] > tests-negative-infinity-lte-positive-infinity eq. > @ negative-infinity.lte positive-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-lte-nan +[] > tests-negative-infinity-not-lte-nan eq. > @ negative-infinity.lte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lte-int +[] > tests-negative-infinity-lte-int eq. > @ negative-infinity.lte 42 true # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-lte-float +[] > tests-negative-infinity-lte-float eq. > @ negative-infinity.lte 42.5 true # Greater than. -[] > negative-infinity-gt-negative-infinity +[] > tests-negative-infinity-gt-negative-infinity not. > @ gt. negative-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gt-positive-infinity +[] > tests-negative-infinity-not-gt-positive-infinity eq. > @ negative-infinity.gt positive-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gt-nan +[] > tests-negative-infinity-not-gt-nan eq. > @ negative-infinity.gt nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gt-int +[] > tests-negative-infinity-not-gt-int eq. > @ negative-infinity.gt 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gt-float +[] > tests-negative-infinity-not-gt-float eq. > @ negative-infinity.gt 42.5 false # Greater or equal than. -[] > negative-infinity-gte-negative-infinity +[] > tests-negative-infinity-gte-negative-infinity eq. > @ negative-infinity.gte negative-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gte-positive-infinity +[] > tests-negative-infinity-not-gte-positive-infinity eq. > @ negative-infinity.gte positive-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gte-nan +[] > tests-negative-infinity-not-gte-nan eq. > @ negative-infinity.gte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gte-int +[] > tests-negative-infinity-not-gte-int eq. > @ negative-infinity.gte 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-not-gte-float +[] > tests-negative-infinity-not-gte-float eq. > @ negative-infinity.gte 42.5 false # Times. # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-float-zero +[] > tests-negative-infinity-times-float-zero eq. > @ as-bytes. negative-infinity.times 0.0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-neg-float-zero +[] > tests-negative-infinity-times-neg-float-zero eq. > @ as-bytes. negative-infinity.times -0.0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-int-zero +[] > tests-negative-infinity-times-int-zero eq. > @ as-bytes. positive-infinity.times 0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-nan +[] > tests-negative-infinity-times-nan eq. > @ as-bytes. negative-infinity.times nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-positive-infinity +[] > tests-negative-infinity-times-positive-infinity eq. > @ negative-infinity.times positive-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-negative-infinity +[] > tests-negative-infinity-times-negative-infinity eq. > @ negative-infinity.times negative-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-positive-float +[] > tests-negative-infinity-times-positive-float eq. > @ negative-infinity.times 42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-positive-int +[] > tests-negative-infinity-times-positive-int eq. > @ negative-infinity.times 42 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-negative-float +[] > tests-negative-infinity-times-negative-float eq. > @ negative-infinity.times -42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-times-negative-int +[] > tests-negative-infinity-times-negative-int eq. > @ negative-infinity.times -42 positive-infinity # Plus # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-nan +[] > tests-negative-infinity-plus-nan eq. > @ as-bytes. negative-infinity.plus nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-positive-infinity +[] > tests-negative-infinity-plus-positive-infinity eq. > @ as-bytes. negative-infinity.plus positive-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-negative-infinity +[] > tests-negative-infinity-plus-negative-infinity eq. > @ negative-infinity negative-infinity.plus negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-positive-float +[] > tests-negative-infinity-plus-positive-float eq. > @ negative-infinity.plus 42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-positive-int +[] > tests-negative-infinity-plus-positive-int eq. > @ negative-infinity.plus 42 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-negative-float +[] > tests-negative-infinity-plus-negative-float eq. > @ negative-infinity.plus -42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-plus-negative-int +[] > tests-negative-infinity-plus-negative-int eq. > @ negative-infinity.plus -42 negative-infinity # Negation. # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-neg-is-positive-infinity +[] > tests-negative-infinity-neg-is-positive-infinity eq. > @ negative-infinity.neg positive-infinity # Minus. # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-nan +[] > tests-negative-infinity-minus-nan eq. > @ as-bytes. negative-infinity.minus nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-negative-infinity +[] > tests-negative-infinity-minus-negative-infinity eq. > @ as-bytes. negative-infinity.minus negative-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-positive-infinity +[] > tests-negative-infinity-minus-positive-infinity eq. > @ negative-infinity.minus positive-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-positive-float +[] > tests-negative-infinity-minus-positive-float eq. > @ negative-infinity.minus 42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-positive-int +[] > tests-negative-infinity-minus-positive-int eq. > @ negative-infinity.minus 42 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-negative-float +[] > tests-negative-infinity-minus-negative-float eq. > @ negative-infinity.minus -42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-minus-negative-int +[] > tests-negative-infinity-minus-negative-int eq. > @ negative-infinity.minus -42 negative-infinity # Division # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-float-zero +[] > tests-negative-infinity-div-float-zero eq. > @ negative-infinity.div 0.0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-neg-float-zero +[] > tests-negative-infinity-div-neg-float-zero eq. > @ negative-infinity.div -0.0 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-int-zero +[] > tests-negative-infinity-div-int-zero eq. > @ negative-infinity.div 0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-neg-int-zero +[] > tests-negative-infinity-div-neg-int-zero eq. > @ negative-infinity.div -0 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-nan +[] > tests-negative-infinity-div-nan eq. > @ as-bytes. negative-infinity.div nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-positive-infinity +[] > tests-negative-infinity-div-positive-infinity eq. > @ as-bytes. negative-infinity.div positive-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-negative-infinity +[] > tests-negative-infinity-div-negative-infinity eq. > @ as-bytes. negative-infinity.div negative-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-positive-float +[] > tests-negative-infinity-div-positive-float eq. > @ negative-infinity.div 42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-positive-int +[] > tests-negative-infinity-div-positive-int eq. > @ negative-infinity.div 42 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-negative-float +[] > tests-negative-infinity-div-negative-float eq. > @ negative-infinity.div -42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-div-negative-int +[] > tests-negative-infinity-div-negative-int eq. > @ negative-infinity.div -42 positive-infinity # Bytes. # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-as-bytes-is-valid +[] > tests-negative-infinity-as-bytes-is-valid eq. > @ negative-infinity.as-bytes (-1.0.div 0.0).as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-floor-is-equal-to-self +[] > tests-negative-infinity-floor-is-equal-to-self negative-infinity.floor.eq negative-infinity > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-is-not-nan +[] > tests-negative-infinity-is-not-nan negative-infinity.is-nan.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-is-not-finite +[] > tests-negative-infinity-is-not-finite negative-infinity.is-finite.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > negative-infinity-is-not-integer +[] > tests-negative-infinity-is-not-integer negative-infinity.is-integer.not > @ diff --git a/eo-runtime/src/test/eo/org/eolang/number-tests.eo b/eo-runtime/src/test/eo/org/eolang/number-tests.eo index baf0d77bcf..e3b430f9c0 100644 --- a/eo-runtime/src/test/eo/org/eolang/number-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/number-tests.eo @@ -27,13 +27,13 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > int-less-true +[] > tests-int-less-true lt. > @ 10 50 # This unit test is supposed to check the functionality of the corresponding object. -[] > int-less-equal +[] > tests-int-less-equal eq. > @ not. lt. @@ -42,7 +42,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-less-false +[] > tests-int-less-false eq. > @ not. lt. @@ -51,7 +51,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-greater-true +[] > tests-int-greater-true eq. > @ gt. -200 @@ -59,7 +59,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-greater-false +[] > tests-int-greater-false eq. > @ not. gt. @@ -68,7 +68,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-greater-equal +[] > tests-int-greater-equal eq. > @ not. gt. @@ -77,7 +77,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-leq-true +[] > tests-int-leq-true eq. > @ lte. -200 @@ -85,7 +85,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-leq-equal +[] > tests-int-leq-equal eq. > @ lte. 50 @@ -93,7 +93,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-leq-false +[] > tests-int-leq-false eq. > @ not. lte. @@ -102,7 +102,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-gte-true +[] > tests-int-gte-true eq. > @ gte. -1000 @@ -110,7 +110,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-gte-equal +[] > tests-int-gte-equal eq. > @ gte. 113 @@ -118,7 +118,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-gte-false +[] > tests-int-gte-false eq. > @ not. gte. @@ -127,7 +127,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-equal-to-nan-and-infinites-is-false +[] > tests-int-equal-to-nan-and-infinites-is-false eq. > @ and. and. @@ -143,7 +143,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-zero-eq-to-zero +[] > tests-int-zero-eq-to-zero eq. > @ eq. 0 @@ -151,7 +151,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-zero-eq-to-float-zero +[] > tests-int-zero-eq-to-float-zero eq. > @ eq. 0 @@ -159,7 +159,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-eq-true +[] > tests-int-eq-true eq. > @ eq. 123 @@ -167,7 +167,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > int-eq-false +[] > tests-int-eq-false eq. > @ not. eq. @@ -176,25 +176,25 @@ true # Test -[] > one-plus-one +[] > tests-one-plus-one eq. > @ 1.plus 1 2 # Test -[] > one-minus-one +[] > tests-one-minus-one eq. > @ 1.minus 1 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-number-types +[] > tests-compares-two-different-number-types eq. > @ 68.eq "12345678" false # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-fibonacci-number-with-recursion +[] > tests-calculates-fibonacci-number-with-recursion # Fibonacci. [n] > fibo if. > @ @@ -208,7 +208,7 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-fibonacci-number-with-tail +[] > tests-calculates-fibonacci-number-with-tail eq. > @ fibonacci 4 3 @@ -235,7 +235,7 @@ rec (n.minus 1) (minus1.plus minus2) minus1 # Checks that division by zero does not return an error object. -[] > zero-division +[] > tests-zero-division try > @ seq * @@ -245,33 +245,33 @@ false # Checks that division by one returns the dividend. -[] > division-by-one +[] > tests-division-by-one -235 > dividend eq. > @ dividend.div 1 dividend # Checks that div works properly with dividends greater than zero -[] > div-for-dividend-greater-than-zero +[] > tests-div-for-dividend-greater-than-zero eq. > @ 256.div 16 16 # Checks div with remainder -[] > div-with-remainder +[] > tests-div-with-remainder eq. > @ floor. 13.div -5 -2 # This unit test is supposed to check the functionality of the corresponding object. -[] > div-less-than-one +[] > tests-div-less-than-one lt. > @ 1.div 5 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > to-bytes-and-backwards +[] > tests-to-bytes-and-backwards eq. > @ as-number. as-bytes. @@ -279,25 +279,25 @@ 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > as-bytes-equals-to-int +[] > tests-as-bytes-equals-to-int eq. > @ 42 42.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > as-bytes-equals-to-int-backwards +[] > tests-as-bytes-equals-to-int-backwards eq. > @ 42.as-bytes 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > multiply-by-zero +[] > tests-multiply-by-zero eq. > @ 1000.times 0 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-number-is-not-nan +[] > tests-simple-number-is-not-nan 42.5.is-nan.not > @ # This unit test is supposed to check the functionality of the corresponding object. @@ -310,9 +310,9 @@ 32.is-finite > [] > simple-number-is-finite # Test -[] > number-with-nan-bytes-is-nan +[] > tests-number-with-nan-bytes-is-nan (number nan.as-bytes).is-nan > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > number-with-infinite-bytes-is-not-finite +[] > tests-number-with-infinite-bytes-is-not-finite (number positive-infinity.as-bytes).is-finite.not > @ diff --git a/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo b/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo index c484f3d0f0..a77f7aa2bc 100644 --- a/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/positive-infinity-tests.eo @@ -27,169 +27,169 @@ +version 0.0.0 # Equal to. -[] > positive-infinity-is-equal-to-one-div-zero +[] > tests-positive-infinity-is-equal-to-one-div-zero eq. > @ positive-infinity 1.0.div 0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-eq-positive-infinity +[] > tests-positive-infinity-eq-positive-infinity eq. > @ positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-eq-negative-infinity +[] > tests-positive-infinity-not-eq-negative-infinity not. > @ eq. positive-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-eq-nan +[] > tests-positive-infinity-not-eq-nan not. > @ eq. positive-infinity nan # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-eq-int +[] > tests-positive-infinity-not-eq-int not. > @ eq. positive-infinity 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-eq-float +[] > tests-positive-infinity-not-eq-float not. > @ eq. positive-infinity 42.5 # Less than. -[] > positive-infinity-lt-positive-infinity +[] > tests-positive-infinity-lt-positive-infinity eq. > @ positive-infinity.lt positive-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lt-negative-infinity +[] > tests-positive-infinity-not-lt-negative-infinity eq. > @ positive-infinity.lt negative-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lt-nan +[] > tests-positive-infinity-not-lt-nan eq. > @ positive-infinity.lt nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lt-int +[] > tests-positive-infinity-not-lt-int eq. > @ positive-infinity.lt 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lt-float +[] > tests-positive-infinity-not-lt-float eq. > @ positive-infinity.lt 42.5 false # Less or equal than. -[] > positive-infinity-lte-positive-infinity +[] > tests-positive-infinity-lte-positive-infinity eq. > @ positive-infinity.lte positive-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lte-negative-infinity +[] > tests-positive-infinity-not-lte-negative-infinity eq. > @ positive-infinity.lte negative-infinity false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lte-nan +[] > tests-positive-infinity-not-lte-nan eq. > @ positive-infinity.lte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lte-int +[] > tests-positive-infinity-not-lte-int eq. > @ positive-infinity.lte 42 false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-lte-float +[] > tests-positive-infinity-not-lte-float eq. > @ positive-infinity.lte 42.5 false # Greater than. -[] > positive-infinity-gt-positive-infinity +[] > tests-positive-infinity-gt-positive-infinity not. > @ gt. positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gt-negative-infinity +[] > tests-positive-infinity-gt-negative-infinity gt. > @ positive-infinity negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-gt-nan +[] > tests-positive-infinity-not-gt-nan not. > @ gt. positive-infinity nan # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gt-int +[] > tests-positive-infinity-gt-int gt. > @ positive-infinity 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gt-float +[] > tests-positive-infinity-gt-float gt. > @ positive-infinity 42.5 # Greater or equal than. -[] > positive-infinity-gte-positive-infinity +[] > tests-positive-infinity-gte-positive-infinity eq. > @ positive-infinity.gte positive-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gte-negative-infinity +[] > tests-positive-infinity-gte-negative-infinity eq. > @ positive-infinity.gte negative-infinity true # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-not-gte-nan +[] > tests-positive-infinity-not-gte-nan eq. > @ positive-infinity.gte nan false # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gte-int +[] > tests-positive-infinity-gte-int eq. > @ positive-infinity.gte 42 true # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-gte-float +[] > tests-positive-infinity-gte-float eq. > @ positive-infinity.gte 42.5 true # This unit test is supposed to check the functionality of the corresponding object. -[] > float-equal-to-nan-and-infinites-is-false-highload +[] > tests-float-equal-to-nan-and-infinites-is-false-highload negative-infinity > neg-inf eq. > @ and. @@ -219,238 +219,238 @@ # Times. # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-float-zero +[] > tests-positive-infinity-times-float-zero eq. > @ as-bytes. positive-infinity.times 0.0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-neg-float-zero +[] > tests-positive-infinity-times-neg-float-zero eq. > @ as-bytes. positive-infinity.times -0.0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-int-zero +[] > tests-positive-infinity-times-int-zero eq. > @ as-bytes. positive-infinity.times 0 nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-nan +[] > tests-positive-infinity-times-nan eq. > @ as-bytes. positive-infinity.times nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-negative-infinity +[] > tests-positive-infinity-times-negative-infinity negative-infinity > neg-inf eq. > @ positive-infinity.times neg-inf neg-inf # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-positive-infinity +[] > tests-positive-infinity-times-positive-infinity eq. > @ positive-infinity.times positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-positive-float +[] > tests-positive-infinity-times-positive-float eq. > @ positive-infinity.times 42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-positive-int +[] > tests-positive-infinity-times-positive-int eq. > @ positive-infinity.times 42 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-negative-float +[] > tests-positive-infinity-times-negative-float eq. > @ positive-infinity.times -42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-times-negative-int +[] > tests-positive-infinity-times-negative-int eq. > @ positive-infinity.times -42 negative-infinity # Plus # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-plus-nan +[] > tests-positive-infinity-plus-nan eq. > @ as-bytes. positive-infinity.plus nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-plus-negative-infinity +[] > tests-positive-infinity-plus-negative-infinity eq. > @ as-bytes. positive-infinity.plus negative-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-plus-positive-infinity +[] > tests-positive-infinity-plus-positive-infinity eq. > @ positive-infinity.plus positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-plus-positive-float +[] > tests-positive-infinity-plus-positive-float eq. > @ positive-infinity.plus 42.5 positive-infinity # Negation # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-neg-is-negative-infinity +[] > tests-positive-infinity-neg-is-negative-infinity eq. > @ positive-infinity.neg negative-infinity # Minus # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-nan +[] > tests-positive-infinity-minus-nan eq. > @ as-bytes. positive-infinity.minus nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-positive-infinity +[] > tests-positive-infinity-minus-positive-infinity eq. > @ as-bytes. positive-infinity.minus positive-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-negative-infinity +[] > tests-positive-infinity-minus-negative-infinity eq. > @ positive-infinity.minus negative-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-positive-float +[] > tests-positive-infinity-minus-positive-float eq. > @ positive-infinity.minus 42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-positive-int +[] > tests-positive-infinity-minus-positive-int eq. > @ positive-infinity.minus 42 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-negative-float +[] > tests-positive-infinity-minus-negative-float eq. > @ positive-infinity.minus -42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-minus-negative-int +[] > tests-positive-infinity-minus-negative-int eq. > @ positive-infinity.minus -42 positive-infinity # Division # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-float-zero +[] > tests-positive-infinity-div-float-zero eq. > @ positive-infinity.div 0.0 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-neg-float-zero +[] > tests-positive-infinity-div-neg-float-zero eq. > @ positive-infinity.div -0.0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-int-zero +[] > tests-positive-infinity-div-int-zero eq. > @ positive-infinity.div 0 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-neg-int-zero +[] > tests-positive-infinity-div-neg-int-zero eq. > @ positive-infinity.div -0 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-nan +[] > tests-positive-infinity-div-nan eq. > @ as-bytes. positive-infinity.div nan nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-negative-infinity +[] > tests-positive-infinity-div-negative-infinity eq. > @ as-bytes. positive-infinity.div negative-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-positive-infinity +[] > tests-positive-infinity-div-positive-infinity eq. > @ as-bytes. positive-infinity.div positive-infinity nan.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-positive-float +[] > tests-positive-infinity-div-positive-float eq. > @ positive-infinity.div 42.5 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-positive-int +[] > tests-positive-infinity-div-positive-int eq. > @ positive-infinity.div 42 positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-negative-float +[] > tests-positive-infinity-div-negative-float eq. > @ positive-infinity.div -42.5 negative-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-div-negative-int +[] > tests-positive-infinity-div-negative-int eq. > @ positive-infinity.div -42 negative-infinity # Bytes. # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-as-bytes-is-valid +[] > tests-positive-infinity-as-bytes-is-valid eq. > @ positive-infinity.as-bytes (1.0.div 0.0).as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-floor-is-equal-to-self +[] > tests-positive-infinity-floor-is-equal-to-self positive-infinity.floor.eq positive-infinity > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-is-not-nan +[] > tests-positive-infinity-is-not-nan positive-infinity.is-nan.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-is-not-finite +[] > tests-positive-infinity-is-not-finite positive-infinity.is-finite.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > positive-infinity-is-not-integer +[] > tests-positive-infinity-is-not-integer positive-infinity.is-integer.not > @ diff --git a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo index 91c039fcac..e2ccba7d49 100644 --- a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo @@ -32,7 +32,7 @@ true > global-test # This unit test is supposed to check the functionality of the corresponding object. -[] > understands-this-correctly +[] > tests-understands-this-correctly [x] > a $.x > @ eq. > @ @@ -40,7 +40,7 @@ true > global-test 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > takes-parent-object +[] > tests-takes-parent-object [x] > a [] > take ^.x > @ @@ -50,7 +50,7 @@ true > global-test 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-object-a-constant +[] > tests-makes-object-a-constant [] > foo times. > @ 50 @@ -61,7 +61,7 @@ true > global-test f # This unit test is supposed to check the functionality of the corresponding object. -[] > takes-parent-through-attribute +[] > tests-takes-parent-through-attribute 42 > x $ > this [] > @ @@ -72,14 +72,14 @@ true > global-test 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-when-applies-to-closed-object +[] > tests-throws-when-applies-to-closed-object [x] > a x > @ a false > closed closed true > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-deep-object-recursively +[] > tests-makes-deep-object-recursively eq. > @ x 5 0 @@ -91,7 +91,7 @@ true > global-test i.minus 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-only-once +[] > tests-calculates-only-once eq. > @ malloc.for 0 @@ -108,7 +108,7 @@ true > global-test 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > recursion-without-arguments +[] > tests-recursion-without-arguments [n] > func if. > @ n.as-number.gt 0 @@ -125,19 +125,19 @@ true > global-test 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > unescapes-slashes +[] > tests-unescapes-slashes eq. > @ "x\\b\\f\\u\\r\\t\\n\\'" 78-5C-62-5C-66-5C-75-5C-72-5C-74-5C-6E-5C-27 # This unit test is supposed to check the functionality of the corresponding object. -[] > unescapes-symbols +[] > tests-unescapes-symbols eq. > @ "\b\f\n\r\t\u27E6" 08-0C-0A-0D-09-E2-9F-A6 # This unit test is supposed to check the functionality of the corresponding object. -[] > compiles-correctly-with-long-duplicate-names +[] > tests-compiles-correctly-with-long-duplicate-names [] > long-object-name [] > long-object-name [] > long-object-name @@ -147,14 +147,14 @@ true > global-test true > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > named-inner-abstract-object +[] > tests-named-inner-abstract-object seq > @ * [] > a true > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > app-that-calls-func +[] > tests-app-that-calls-func [] > app [args] > f 1 > a @@ -167,7 +167,7 @@ true > global-test 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > directly-accesses-objects-from-root +[] > tests-directly-accesses-objects-from-root eq. > @ Q.org.eolang.malloc.of 8 @@ -180,7 +180,7 @@ true > global-test 40 # This unit test is supposed to check the functionality of the corresponding object. -[] > directly-accesses-objects-from-standard-root +[] > tests-directly-accesses-objects-from-standard-root eq. > @ QQ.malloc.of 8 @@ -193,7 +193,7 @@ true > global-test 40 # This unit test is supposed to check the functionality of the corresponding object. -[] > standard-root-and-root +[] > tests-standard-root-and-root QQ.sys.os > stand-root Q.org.eolang.sys.os > root eq. > @ @@ -201,7 +201,7 @@ true > global-test stand-root # This unit test is supposed to check the functionality of the corresponding object. -[] > extract-attribute-from-decoratee +[] > tests-extract-attribute-from-decoratee [foo] > return [] > a ^.return > @ @@ -213,7 +213,7 @@ true > global-test 43 # This unit test is supposed to check the functionality of the corresponding object. -[] > constant-defends-against-side-effects +[] > tests-constant-defends-against-side-effects [x] > inc seq > @ * @@ -233,7 +233,7 @@ true > global-test 64 # This unit test is supposed to check the functionality of the corresponding object. -[] > parent-in-vertical-notation +[] > tests-parent-in-vertical-notation 5 > m [] > value [] > @ @@ -245,7 +245,7 @@ true > global-test 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > parent-in-horizontal-notation +[] > tests-parent-in-horizontal-notation 5 > m [] > value [] > @ @@ -255,7 +255,7 @@ true > global-test 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > phi-in-vertical-notation +[] > tests-phi-in-vertical-notation [] > value [] > @ 100 > @ @@ -265,7 +265,7 @@ true > global-test 100 # This unit test is supposed to check the functionality of the corresponding object. -[] > phi-in-horizontal-notation +[] > tests-phi-in-horizontal-notation [] > value [] > @ 100 > @ @@ -274,7 +274,7 @@ true > global-test 100 # This unit test is supposed to check the functionality of the corresponding object. -[] > right-way-to-use-hierarchy +[] > tests-right-way-to-use-hierarchy # Bool mock [value] > pybool value > @ @@ -286,7 +286,7 @@ true > global-test ((pyint 1).add (pyint 3)).eq (pyint 4) > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > check-triple-quotes +[] > tests-check-triple-quotes eq. > @ """ Hello @@ -296,7 +296,7 @@ true > global-test "Hello\n\nHello" # This unit test is supposed to check the functionality of the corresponding object. -[] > correctly-handles-same-name-attrs-simplified +[] > tests-correctly-handles-same-name-attrs-simplified [first second] > calc plus. > @ first @@ -314,7 +314,7 @@ true > global-test 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > correctly-handles-same-name-attrs +[] > tests-correctly-handles-same-name-attrs [f s] > calc plus. > @ f.next @@ -340,7 +340,7 @@ true > global-test 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > with-void-phi +[] > tests-with-void-phi [@] > x "Hello" > hello x 5 > five @@ -352,7 +352,7 @@ true > global-test [] (seq (* (five.eq 5) true) > @) (5 > five) > complex-horizontal # This unit test is supposed to check the functionality of the corresponding object. -[] > vertical-bound-method +[] > tests-vertical-bound-method eq. > @ if. true @@ -362,7 +362,7 @@ true > global-test "first" # Nesting blah test. -[] > nesting-blah-test +[] > tests-nesting-blah-test blah0 > @ [] > blah0 blah1 > @ diff --git a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo index 0708de2145..06aaa033f3 100644 --- a/eo-runtime/src/test/eo/org/eolang/seq-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/seq-tests.eo @@ -28,7 +28,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-float-less +[] > tests-seq-single-dataization-float-less malloc.of > @ 1 [b] @@ -44,7 +44,7 @@ 1.1 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-float-greater +[] > tests-seq-single-dataization-float-greater malloc.of > @ 1 [b] @@ -60,7 +60,7 @@ 0.9 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-int-less +[] > tests-seq-single-dataization-int-less malloc.of > @ 1 [b] @@ -76,7 +76,7 @@ 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-int-less-or-equal +[] > tests-seq-single-dataization-int-less-or-equal malloc.of > @ 1 [b] @@ -92,7 +92,7 @@ 1 # This test should have acceptable time to pass. -[] > very-long-seq +[] > tests-very-long-seq eq. > @ true seq @@ -141,7 +141,7 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-int-equal-to-test +[] > tests-seq-single-dataization-int-equal-to-test malloc.of > @ 1 [b] @@ -158,7 +158,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-single-dataization-int-equal-to-cache-problem-test +[] > tests-seq-single-dataization-int-equal-to-cache-problem-test malloc.of > @ 1 [b] @@ -177,7 +177,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-calculates-and-returns +[] > tests-seq-calculates-and-returns eq. > @ 1 seq @@ -186,7 +186,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > seq-calculates-and-returns-object +[] > tests-seq-calculates-and-returns-object eq. > @ "Hello!" seq diff --git a/eo-runtime/src/test/eo/org/eolang/string-tests.eo b/eo-runtime/src/test/eo/org/eolang/string-tests.eo index 0cd4f6c942..2f45405e4d 100644 --- a/eo-runtime/src/test/eo/org/eolang/string-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/string-tests.eo @@ -27,45 +27,45 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > calculates-length-of-spaces-only +[] > tests-calculates-length-of-spaces-only eq. > @ " ".length 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > turns-string-into-bytes +[] > tests-turns-string-into-bytes eq. > @ "€ друг".as-bytes E2-82-AC-20-D0-B4-D1-80-D1-83-D0-B3 # This unit test is supposed to check the functionality of the corresponding object. -[] > bytes-equal-to-string +[] > tests-bytes-equal-to-string eq. > @ D0-B4-D1-80-D1-83-D0-B3 "друг" # This unit test is supposed to check the functionality of the corresponding object. -[] > string-equals-to-bytes +[] > tests-string-equals-to-bytes eq. > @ "друг" D0-B4-D1-80-D1-83-D0-B3 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-the-length-with-2-byte-characters +[] > tests-reads-the-length-with-2-byte-characters "Hello, друг!" > str and. > @ str.length.eq 12 str.as-bytes.size.eq 16 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-the-length-with-3-byte-characters +[] > tests-reads-the-length-with-3-byte-characters "The अ devanagari" > str and. > @ str.length.eq 16 str.as-bytes.size.eq 18 # This unit test is supposed to check the functionality of the corresponding object. -[] > reads-the-length-with-4-byte-characters +[] > tests-reads-the-length-with-4-byte-characters "The 😀 smile" > str and. > @ str.length.eq 11 @@ -74,39 +74,39 @@ # This unit test is supposed to check the functionality of the corresponding object. # The smile emoji is F0-9F-98-80 in bytes. Here we check if string.length fails if it faces # incomplete 4 byte character. -[] > throws-on-taking-length-of-incomplete-4-byte-character +[] > tests-throws-on-taking-length-of-incomplete-4-byte-character string F0-9F-98 > should-be-smile should-be-smile.length > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-string-types +[] > tests-compares-two-different-string-types not. > @ eq. "Hello" 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-string-with-nan +[] > tests-compares-string-with-nan not. > @ eq. nan "друг" # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-string-with-positive-infinity +[] > tests-compares-string-with-positive-infinity eq. > @ positive-infinity.eq "друг" false # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-string-with-negative-infinity +[] > tests-compares-string-with-negative-infinity not. > @ eq. negative-infinity "друг" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-block-one-line +[] > tests-text-block-one-line eq. > @ """ Abc @@ -114,7 +114,7 @@ "Abc" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-block-tree-lines +[] > tests-text-block-tree-lines eq. > @ """ e @@ -124,7 +124,7 @@ 65-0A-65-0A-65 # This unit test is supposed to check the functionality of the corresponding object. -[] > text-block-with-margin +[] > tests-text-block-with-margin eq. > @ """ z @@ -134,20 +134,20 @@ 7A-0A-20-20-79-0A-20-78 # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-different-strings +[] > tests-compares-two-different-strings not. > @ eq. "Hello" "Good bye" # This unit test is supposed to check the functionality of the corresponding object. -[] > supports-escape-sequences +[] > tests-supports-escape-sequences eq. > @ "Hello, \u0434\u0440\u0443\u0433!\n" "Hello, друг!\n" # This unit test is supposed to check the functionality of the corresponding object. -[] > supports-escape-sequences-in-text +[] > tests-supports-escape-sequences-in-text eq. > @ """ Hello, \u0434\u0440\u0443\u0433!\n @@ -155,7 +155,7 @@ "Hello, друг!\n" # This unit test is supposed to check the functionality of the corresponding object. -[] > preserves-indentation-in-text +[] > tests-preserves-indentation-in-text eq. > @ """ a @@ -165,7 +165,7 @@ "a\n b\n c" # This unit test is supposed to check the functionality of the corresponding object. -[] > compares-two-strings +[] > tests-compares-two-strings eq. > @ eq. "x" @@ -173,55 +173,55 @@ true # This unit test is supposed to check the functionality of the corresponding object. -[] > one-symbol-string-compares +[] > tests-one-symbol-string-compares eq. > @ "Ф" "Ф" # This unit test is supposed to check the functionality of the corresponding object. -[] > supports-escape-sequences-line-break +[] > tests-supports-escape-sequences-line-break eq. > @ "\n" "\012" # This unit test is supposed to check the functionality of the corresponding object. -[] > supports-escape-sequences-unicode +[] > tests-supports-escape-sequences-unicode eq. > @ "\u0424" "Ф" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-from-start +[] > tests-slice-from-start eq. > @ "hello".slice 0 1 "h" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-in-the-middle +[] > tests-slice-in-the-middle eq. > @ "hello".slice 2 3 "llo" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-from-the-end +[] > tests-slice-from-the-end eq. > @ "hello".slice 4 1 "o" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-empty-string +[] > tests-slice-empty-string eq. > @ "".slice 0 0 "" # This unit test is supposed to check the functionality of the corresponding object. -[] > no-slice-string +[] > tests-no-slice-string eq. > @ "no slice".slice 0 0 "" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-escape-sequences-line-break +[] > tests-slice-escape-sequences-line-break eq. > @ "\n".slice 0 @@ -229,7 +229,7 @@ "\012" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-escape-sequences-unicode +[] > tests-slice-escape-sequences-unicode eq. > @ "\u0424".slice 0 @@ -237,25 +237,25 @@ "Ф" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-with-2-byte-characters +[] > tests-slice-with-2-byte-characters eq. > @ "привет".slice 1 2 "ри" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-with-3-byte-characters +[] > tests-slice-with-3-byte-characters eq. > @ "The अ is अ".slice 1 6 "he अ i" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-with-4-byte-characters +[] > tests-slice-with-4-byte-characters eq. > @ "One 😀 and 😀 another".slice 3 8 " 😀 and 😀" # This unit test is supposed to check the functionality of the corresponding object. -[] > slice-foreign-literals +[] > tests-slice-foreign-literals eq. > @ "hello, 大家!".slice 7 @@ -263,21 +263,21 @@ "大" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-slicing-start-below-zero +[] > tests-throws-on-slicing-start-below-zero slice. > @ "some string" -1 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-slicing-end-below-start +[] > tests-throws-on-slicing-end-below-start slice. > @ "some string" 2 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-slicing-end-greater-actual +[] > tests-throws-on-slicing-end-greater-actual slice. > @ "some string" 7 diff --git a/eo-runtime/src/test/eo/org/eolang/structs/bytes-as-array-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/bytes-as-array-tests.eo index bf14583a5b..270326e75a 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/bytes-as-array-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/bytes-as-array-tests.eo @@ -29,7 +29,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-bytes-to-array +[] > tests-converts-bytes-to-array eq. > @ list bytes-as-array @@ -37,7 +37,7 @@ * 20- 1F- EE- B5- FF- # This unit test is supposed to check the functionality of the corresponding object. -[] > single-byte-to-array +[] > tests-single-byte-to-array eq. > @ list bytes-as-array @@ -45,7 +45,7 @@ * 1F- # This unit test is supposed to check the functionality of the corresponding object. -[] > zero-bytes-to-array +[] > tests-zero-bytes-to-array eq. > @ list bytes-as-array diff --git a/eo-runtime/src/test/eo/org/eolang/structs/hash-code-of-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/hash-code-of-tests.eo index 8a413b57ae..f4840f1fdb 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/hash-code-of-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/hash-code-of-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-code-of-bools-is-number +[] > tests-hash-code-of-bools-is-number hash-code-of true > true-code hash-code-of false > false-code and. > @ @@ -36,7 +36,7 @@ false-code.as-bytes.size.eq 8 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-code-of-int-is-int +[] > tests-hash-code-of-int-is-int hash-code-of 42 > num-code! eq. > @ 1 @@ -45,34 +45,34 @@ number num-code # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-big-ints-are-equal +[] > tests-hash-codes-of-the-same-big-ints-are-equal 123456789012345678 > big-int eq. > @ hash-code-of big-int hash-code-of big-int # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-ints-are-equal +[] > tests-hash-codes-of-the-same-ints-are-equal eq. > @ hash-code-of 42 hash-code-of 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-ints-are-not-equal +[] > tests-hash-codes-of-different-ints-are-not-equal not. > @ eq. hash-code-of 42 hash-code-of 24 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-sign-ints-are-not-equal +[] > tests-hash-codes-of-different-sign-ints-are-not-equal not. > @ eq. hash-code-of 42 hash-code-of -42 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-code-of-string-is-int +[] > tests-hash-code-of-string-is-int hash-code-of "hello" > str-code! eq. > @ 1 @@ -81,27 +81,27 @@ number str-code # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-strings-are-equal +[] > tests-hash-codes-of-the-same-strings-are-equal eq. > @ hash-code-of "Hello" hash-code-of "Hello" # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-same-length-strings-are-not-equal +[] > tests-hash-codes-of-same-length-strings-are-not-equal not. > @ eq. hash-code-of "one" hash-code-of "two" # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-strings-are-not-equal +[] > tests-hash-codes-of-different-strings-are-not-equal not. > @ eq. hash-code-of "hello" hash-code-of "bye!!!" # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-code-of-abstract-object-is-int +[] > tests-hash-code-of-abstract-object-is-int [x] > obj x > @ hash-code-of (obj 42) > obj-code! @@ -112,7 +112,7 @@ number obj-code # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-abstract-objects-are-equal +[] > tests-hash-codes-of-the-same-abstract-objects-are-equal [x] > obj x > @ obj 42 > forty-two-obj @@ -121,7 +121,7 @@ hash-code-of forty-two-obj # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-abstract-objects-are-not-equal +[] > tests-hash-codes-of-different-abstract-objects-are-not-equal [x] > obj x > @ not. > @ @@ -130,7 +130,7 @@ hash-code-of (obj "42") # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-code-of-float-is-int +[] > tests-hash-code-of-float-is-int hash-code-of 42.42 > float-code! eq. > @ 1 @@ -139,28 +139,28 @@ number float-code # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-floats-are-equal +[] > tests-hash-codes-of-the-same-floats-are-equal 0.911 > emergency eq. > @ hash-code-of emergency hash-code-of emergency # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-the-same-big-floats-are-equal +[] > tests-hash-codes-of-the-same-big-floats-are-equal 42.42e42 > big-float! eq. > @ hash-code-of big-float hash-code-of big-float # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-floats-are-not-equal +[] > tests-hash-codes-of-different-floats-are-not-equal not. > @ eq. hash-code-of 3.14 hash-code-of 2.72 # This unit test is supposed to check the functionality of the corresponding object. -[] > hash-codes-of-different-sign-floats-are-not-equal +[] > tests-hash-codes-of-different-sign-floats-are-not-equal not. > @ eq. hash-code-of 3.22 diff --git a/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo index 47922e0aad..09d4764c68 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/list-tests.eo @@ -30,7 +30,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > list-should-not-be-empty +[] > tests-list-should-not-be-empty not. > @ is-empty. list @@ -40,7 +40,7 @@ (list *).is-empty > [] > list-should-be-empty # This unit test is supposed to check the functionality of the corresponding object. -[] > list-should-not-be-empty-with-three-objects +[] > tests-list-should-not-be-empty-with-three-objects * > xs [x] [y] @@ -48,13 +48,13 @@ (list xs).is-empty.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > list-should-not-be-empty-with-one-anon-object +[] > tests-list-should-not-be-empty-with-one-anon-object * > xs [f] (list xs).is-empty.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > list-simple-with +[] > tests-list-simple-with eq. > @ with. list @@ -63,7 +63,7 @@ * 1 2 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-insert +[] > tests-simple-insert eq. > @ withi. list @@ -73,7 +73,7 @@ * 1 2 3 "hello" 4 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > insert-with-zero-index +[] > tests-insert-with-zero-index eq. > @ withi. list @@ -83,7 +83,7 @@ * "hello" 1 2 3 4 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > reduce-list-with-index +[] > tests-reduce-list-with-index * 2 2 > src eq. > @ 6 @@ -98,7 +98,7 @@ ^.src.at i # This unit test is supposed to check the functionality of the corresponding object. -[] > list-reducedi-long-int-array +[] > tests-list-reducedi-long-int-array eq. > @ reducedi. list @@ -108,7 +108,7 @@ 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-reducedi-bools-array +[] > tests-list-reducedi-bools-array not. > @ reducedi. list @@ -117,7 +117,7 @@ x.and a > [a x i] # This unit test is supposed to check the functionality of the corresponding object. -[] > list-reducedi-nested-functions +[] > tests-list-reducedi-nested-functions eq. > @ reducedi. list @@ -135,7 +135,7 @@ 0.minus 500 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-reduce-without-index +[] > tests-list-reduce-without-index eq. > @ reduced. list @@ -145,7 +145,7 @@ -24 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-reduced-printing +[] > tests-list-reduced-printing eq. > @ reduced. list @@ -159,7 +159,7 @@ "01" # This unit test is supposed to check the functionality of the corresponding object. -[] > complex-objects-list-comparison +[] > tests-complex-objects-list-comparison list > res * list (* 0 1) @@ -172,7 +172,7 @@ * 7 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-mappedi-should-work +[] > tests-list-mappedi-should-work eq. > @ mappedi. list @@ -181,7 +181,7 @@ * 0 2 6 12 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-list-mapping +[] > tests-simple-list-mapping eq. > @ mapped. list @@ -190,7 +190,7 @@ * 2 4 6 # This unit test is supposed to check the functionality of the corresponding object. -[] > iterates-with-eachi +[] > tests-iterates-with-eachi eq. > @ malloc.for 0 @@ -206,7 +206,7 @@ 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > iterates-with-each +[] > tests-iterates-with-each eq. > @ malloc.for 0 @@ -218,7 +218,7 @@ 6 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-withouti +[] > tests-list-withouti eq. > @ withouti. list @@ -227,7 +227,7 @@ * 1 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-withouti-complex-case +[] > tests-list-withouti-complex-case [a] > foo withouti. > @ list a @@ -238,7 +238,7 @@ * "text" "f" # This unit test is supposed to check the functionality of the corresponding object. -[] > list-withouti-nested-array +[] > tests-list-withouti-nested-array * 3 2 1 > nested eq. > @ withouti. @@ -248,7 +248,7 @@ * "smthg" 27 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-without +[] > tests-list-without eq. > @ without. list @@ -257,14 +257,14 @@ * 1 1 1 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > equality-test +[] > tests-equality-test eq. > @ list * 1 2 3 * 1 2 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > not-equality-test +[] > tests-not-equality-test not. > @ eq. list @@ -272,7 +272,7 @@ * 3 2 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > concatenates-lists +[] > tests-concatenates-lists list (* 0 1) > list1 list (* 2 3) > list2 withouti. > list3 @@ -289,7 +289,7 @@ * 1 2 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > concatenates-with-tuple +[] > tests-concatenates-with-tuple eq. > @ concat. list @@ -298,7 +298,7 @@ * 0 1 2 4 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-index-of +[] > tests-returns-index-of eq. > @ 1 index-of. @@ -307,7 +307,7 @@ 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-first-index-of-element +[] > tests-returns-first-index-of-element eq. > @ 0 index-of. @@ -316,7 +316,7 @@ -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-find-index-of +[] > tests-does-not-find-index-of eq. > @ -1 index-of. @@ -325,7 +325,7 @@ 7 # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-index-of-string +[] > tests-finds-index-of-string eq. > @ 1 index-of. @@ -334,7 +334,7 @@ "qwerty" # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-last-index-of +[] > tests-finds-last-index-of eq. > @ 1 last-index-of. @@ -343,7 +343,7 @@ 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-last-index-of-repeated +[] > tests-finds-last-index-of-repeated eq. > @ 2 last-index-of. @@ -352,7 +352,7 @@ 24 # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-not-found +[] > tests-last-index-of-not-found eq. > @ -1 last-index-of. @@ -361,7 +361,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-empty +[] > tests-last-index-of-empty eq. > @ -1 last-index-of. @@ -369,7 +369,7 @@ "abc" # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-unicode +[] > tests-last-index-of-unicode eq. > @ 3 last-index-of. @@ -378,21 +378,21 @@ "Привет" # This unit test is supposed to check the functionality of the corresponding object. -[] > list-contains-string +[] > tests-list-contains-string contains. > @ list * "qwerty" "asdfgh" 3 "qwerty" "qwerty" # This unit test is supposed to check the functionality of the corresponding object. -[] > list-contains-number +[] > tests-list-contains-number contains. > @ list * "qwerty" "asdfgh" 3 "qwerty" 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-does-not-contain +[] > tests-list-does-not-contain not. > @ contains. list @@ -400,7 +400,7 @@ "Hi" # This unit test is supposed to check the functionality of the corresponding object. -[] > filteredi-with-lt +[] > tests-filteredi-with-lt eq. > @ filteredi. list @@ -409,7 +409,7 @@ * 1 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > filteredi-with-string-length +[] > tests-filteredi-with-string-length eq. > @ filteredi. list @@ -418,7 +418,7 @@ * "Hello" # This unit test is supposed to check the functionality of the corresponding object. -[] > filteredi-with-empty-list +[] > tests-filteredi-with-empty-list is-empty. > @ filteredi. list @@ -426,7 +426,7 @@ v.lt 3 > [v i] # This unit test is supposed to check the functionality of the corresponding object. -[] > filteredi-by-index +[] > tests-filteredi-by-index eq. > @ filteredi. list @@ -435,7 +435,7 @@ * 1 4 # This unit test is supposed to check the functionality of the corresponding object. -[] > filteredi-with-bools +[] > tests-filteredi-with-bools eq. > @ filteredi. list @@ -444,7 +444,7 @@ * false # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-filtered +[] > tests-simple-filtered eq. > @ filtered. list @@ -453,7 +453,7 @@ * 3 4 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > filtered-with-bools +[] > tests-filtered-with-bools eq. > @ filtered. list @@ -462,7 +462,7 @@ * false # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-head +[] > tests-simple-head eq. > @ head. list @@ -471,7 +471,7 @@ * 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-head-with-zero-index +[] > tests-list-head-with-zero-index is-empty. > @ head. list @@ -479,7 +479,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > list-head-with-length-index +[] > tests-list-head-with-length-index eq. > @ head. list @@ -488,7 +488,7 @@ * 1 2 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > complex-head +[] > tests-complex-head eq. > @ head. list @@ -497,7 +497,7 @@ * "foo" 2.2 # This unit test is supposed to check the functionality of the corresponding object. -[] > head-with-negative +[] > tests-head-with-negative eq. > @ head. list @@ -506,7 +506,7 @@ * 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > complex-head-with-negative +[] > tests-complex-head-with-negative eq. > @ head. list @@ -515,7 +515,7 @@ * 2.2 00-01 "bar" # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-tail +[] > tests-simple-tail eq. > @ tail. list @@ -524,7 +524,7 @@ * 4 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > zero-index-in-tail +[] > tests-zero-index-in-tail is-empty. > @ tail. list @@ -532,7 +532,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > large-index-in-tail +[] > tests-large-index-in-tail eq. > @ tail. list diff --git a/eo-runtime/src/test/eo/org/eolang/structs/map-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/map-tests.eo index 8d4edb0878..3f4528fddc 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/map-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/map-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > map-rebuilds-itself +[] > tests-map-rebuilds-itself map > mp * map.entry 1 1 @@ -38,7 +38,7 @@ 2.eq mp.size > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > map-rebuilds-itself-only-once +[] > tests-map-rebuilds-itself-only-once eq. > @ 1 malloc.for @@ -56,7 +56,7 @@ m # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-list-of-keys +[] > tests-returns-list-of-keys eq. > @ keys. map @@ -67,7 +67,7 @@ * 1 2 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-list-of-values +[] > tests-returns-list-of-values eq. > @ values. map @@ -78,7 +78,7 @@ * 2 3 4 # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-element-by-key-in-map +[] > tests-finds-element-by-key-in-map map > mp * map.entry "one" 1 @@ -88,7 +88,7 @@ 2.eq found.get > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-find-element-by-key-in-hash-map +[] > tests-does-not-find-element-by-key-in-hash-map map * map.entry "one" 1 @@ -98,7 +98,7 @@ .not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > has-element-with-key-in-hash-map +[] > tests-has-element-with-key-in-hash-map map * map.entry "one" 1 @@ -106,7 +106,7 @@ .has "two" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-have-element-by-key-in-hash-map +[] > tests-does-not-have-element-by-key-in-hash-map map * map.entry "one" 1 @@ -115,7 +115,7 @@ .not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-change-map-without-non-existed-element +[] > tests-does-not-change-map-without-non-existed-element map * map.entry "one" 1 @@ -124,7 +124,7 @@ .eq 1 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > removes-element-from-map-by-key +[] > tests-removes-element-from-map-by-key map * map.entry "one" 1 @@ -135,7 +135,7 @@ (mp.has "one").not # This unit test is supposed to check the functionality of the corresponding object. -[] > adds-new-pair-to-hash-map +[] > tests-adds-new-pair-to-hash-map map * map.entry "one" 1 @@ -145,7 +145,7 @@ mp.has "two" # This unit test is supposed to check the functionality of the corresponding object. -[] > replaces-value-if-pair-with-key-exists-in-map +[] > tests-replaces-value-if-pair-with-key-exists-in-map map * map.entry "one" 1 diff --git a/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo index fd3cc1bb80..38152c4756 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo @@ -28,35 +28,35 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-range-of-ints-from-one-to-ten +[] > tests-simple-range-of-ints-from-one-to-ten eq. > @ range-of-ints 1 10 * 1 2 3 4 5 6 7 8 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > range-of-ints-from-ten-to-ten-is-empty +[] > tests-range-of-ints-from-ten-to-ten-is-empty is-empty. > @ range-of-ints 10 10 # This unit test is supposed to check the functionality of the corresponding object. -[] > range-of-descending-ints-is-empty +[] > tests-range-of-descending-ints-is-empty is-empty. > @ range-of-ints 10 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > range-of-negative-ints-works-as-well +[] > tests-range-of-negative-ints-works-as-well eq. > @ range-of-ints -5 0 * -5 -4 -3 -2 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-range-of-ints-with-non-int-start +[] > tests-throws-on-range-of-ints-with-non-int-start range-of-ints 1.2 3 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-range-of-ints-with-not-int-end +[] > tests-throws-on-range-of-ints-with-not-int-end range-of-ints 1 2.5 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-range-of-not-ints +[] > tests-throws-on-range-of-not-ints range-of-ints 1.5 5.2 > @ diff --git a/eo-runtime/src/test/eo/org/eolang/structs/range-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/range-tests.eo index ab2b5c69b9..2131ec09b1 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/range-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/range-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-range-from-one-to-ten +[] > tests-simple-range-from-one-to-ten range > rng [] [i] > build @@ -41,7 +41,7 @@ * 1 2 3 4 5 6 7 8 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-range-with-floats-from-one-to-five +[] > tests-simple-range-with-floats-from-one-to-five range > rng [] [i] > x @@ -54,7 +54,7 @@ * 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 # This unit test is supposed to check the functionality of the corresponding object. -[] > range-with-out-of-bounds +[] > tests-range-with-out-of-bounds range > rng [] [num] > b @@ -67,7 +67,7 @@ * 1 6 # This unit test is supposed to check the functionality of the corresponding object. -[] > range-with-wrong-items-is-an-empty-array +[] > tests-range-with-wrong-items-is-an-empty-array range > rng [] [num] > y diff --git a/eo-runtime/src/test/eo/org/eolang/structs/set-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/set-tests.eo index ede16131e0..f56d040708 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/set-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/set-tests.eo @@ -28,14 +28,14 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > set-rebuilds-itself +[] > tests-set-rebuilds-itself eq. > @ set * 1 2 2 * 1 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-append-existed-item-to-set +[] > tests-does-not-append-existed-item-to-set set * 1 2 .with 1 @@ -43,14 +43,14 @@ .eq 2 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > appends-new-item-to-set +[] > tests-appends-new-item-to-set set * 1 2 .with 3 .has 3 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > empty-set-has-size-of-zero +[] > tests-empty-set-has-size-of-zero set * .size diff --git a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo index b6464135c0..c126fd0c7d 100644 --- a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo @@ -28,7 +28,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > switch-simple-case +[] > tests-switch-simple-case eq. > @ switch * @@ -41,7 +41,7 @@ "2" # This unit test is supposed to check the functionality of the corresponding object. -[] > switch-strings-case +[] > tests-switch-strings-case "swordfish" > password eq. > @ switch @@ -58,7 +58,7 @@ "password is correct!" # This unit test is supposed to check the functionality of the corresponding object. -[] > switch-with-several-true-cases +[] > tests-switch-with-several-true-cases eq. > @ switch * @@ -74,7 +74,7 @@ "TRUE1" # This unit test is supposed to check the functionality of the corresponding object. -[] > switch-with-all-false-cases +[] > tests-switch-with-all-false-cases switch > @ * * @@ -85,11 +85,11 @@ "false2" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-empty-switch +[] > tests-throws-on-empty-switch switch * > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > switch-complex-case +[] > tests-switch-complex-case [] > c1 false > @ [] > c2 diff --git a/eo-runtime/src/test/eo/org/eolang/sys/os-tests.eo b/eo-runtime/src/test/eo/org/eolang/sys/os-tests.eo index d639237797..80522b6608 100644 --- a/eo-runtime/src/test/eo/org/eolang/sys/os-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/sys/os-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-os-family +[] > tests-checks-os-family or. > @ or. os.is-windows diff --git a/eo-runtime/src/test/eo/org/eolang/sys/posix-tests.eo b/eo-runtime/src/test/eo/org/eolang/sys/posix-tests.eo index feb4d96269..d6869ab2fa 100644 --- a/eo-runtime/src/test/eo/org/eolang/sys/posix-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/sys/posix-tests.eo @@ -29,7 +29,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > invokes-getpid-correctly +[] > tests-invokes-getpid-correctly or. > @ os.is-windows gt. @@ -40,7 +40,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > opens-posix-tcp-socket +[] > tests-opens-posix-tcp-socket code. > sd posix "socket" @@ -56,7 +56,7 @@ * sd # This unit test is supposed to check the functionality of the corresponding object. -[] > closes-posix-tcp-socket +[] > tests-closes-posix-tcp-socket code. > sd posix "socket" @@ -75,7 +75,7 @@ -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-posix-inet-addr-for-localhost +[] > tests-returns-valid-posix-inet-addr-for-localhost code. > addr posix "inet_addr" diff --git a/eo-runtime/src/test/eo/org/eolang/sys/win32-tests.eo b/eo-runtime/src/test/eo/org/eolang/sys/win32-tests.eo index 66d646f17c..e7cbdc4099 100644 --- a/eo-runtime/src/test/eo/org/eolang/sys/win32-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/sys/win32-tests.eo @@ -29,7 +29,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-win32-inet-addr-for-localhost +[] > tests-returns-valid-win32-inet-addr-for-localhost code. > addr win32 "inet_addr" diff --git a/eo-runtime/src/test/eo/org/eolang/try-tests.eo b/eo-runtime/src/test/eo/org/eolang/try-tests.eo index 290eac05c4..5e5fe1b004 100644 --- a/eo-runtime/src/test/eo/org/eolang/try-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/try-tests.eo @@ -27,7 +27,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > catches-simple-exception +[] > tests-catches-simple-exception try > @ slice. "some string" @@ -37,7 +37,7 @@ false # This unit test is supposed to check the functionality of the corresponding object. -[] > two-nested-try-blocks +[] > tests-two-nested-try-blocks try > @ try slice. @@ -50,7 +50,7 @@ false # This unit test is supposed to check the functionality of the corresponding object. -[] > try-without-error-block +[] > tests-try-without-error-block eq. > @ try 30.plus 2 @@ -59,7 +59,7 @@ 32 # This unit test is supposed to check the functionality of the corresponding object. -[] > try-malloc-update-catch +[] > tests-try-malloc-update-catch eq. > @ malloc.of 8 diff --git a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo index 23f11ebb9f..3173d9a8cc 100644 --- a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo @@ -27,26 +27,26 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > makes-tuple-through-special-syntax +[] > tests-makes-tuple-through-special-syntax eq. > @ (* 1 2).length 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > gets-lengths-of-empty-tuple-through-special-syntax +[] > tests-gets-lengths-of-empty-tuple-through-special-syntax eq. > @ *.length 0 # Check that an empty tuples .length equals to zero. -[] > empty-tuple-length +[] > tests-empty-tuple-length [elements] > arr eq. > @ (arr *).elements.length 0 # Check that tuple.length works properly for non-empty tuples. -[] > non-empty-tuple-length-test +[] > tests-non-empty-tuple-length-test [elements] > arr eq. > @ arr @@ -56,14 +56,14 @@ 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-as-a-bound-attribute-size-0 +[] > tests-tuple-as-a-bound-attribute-size-0 * > anArray eq. > @ anArray.length 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-as-a-bound-attribute-size-1 +[] > tests-tuple-as-a-bound-attribute-size-1 * > anArray 100 eq. > @ @@ -71,7 +71,7 @@ 100 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-as-a-bound-attribute-size-2 +[] > tests-tuple-as-a-bound-attribute-size-2 * > arr 1 2 @@ -84,7 +84,7 @@ 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-with +[] > tests-tuple-with with. > arr * 1 2 3 "with" @@ -105,13 +105,13 @@ "with" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-wrong-tuple-at +[] > tests-throws-on-wrong-tuple-at at. > @ * 1 2 3 4 20 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-fluent-with +[] > tests-tuple-fluent-with ((*.with 1).with 2).with 3 > arr and. > @ and. @@ -126,7 +126,7 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-fluent-with-indented +[] > tests-tuple-fluent-with-indented * .with 1 .with 2 @@ -144,41 +144,41 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > gets-lengths-of-empty-tuple +[] > tests-gets-lengths-of-empty-tuple tuple.empty > a eq. > @ a.length 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > gets-lengths-of-empty-tuple-without-additional-obj +[] > tests-gets-lengths-of-empty-tuple-without-additional-obj eq. > @ tuple.empty.length 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > creates-empty-tuple-with-number +[] > tests-creates-empty-tuple-with-number tuple.empty.with 3 > a eq. > @ a.at 0 3 # Test -[] > at-fast-with-first-element +[] > tests-at-fast-with-first-element * 100 101 102 > arr eq. > @ (arr.at 0).at-fast arr 100 # Test -[] > at-fast-with-last-element +[] > tests-at-fast-with-last-element * 100 101 102 > arr eq. > @ (arr.at 2).at-fast arr 102 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-empty-fluent-with-indented-keyword +[] > tests-tuple-empty-fluent-with-indented-keyword tuple .empty .with 1 @@ -197,20 +197,20 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-with-negative-index-gets-last +[] > tests-tuple-with-negative-index-gets-last * 0 1 2 3 4 > arr eq. > @ arr.at -1 4 # This unit test is supposed to check the functionality of the corresponding object. -[] > tuple-with-negative-index-gets-first +[] > tests-tuple-with-negative-index-gets-first * 0 1 2 3 4 > arr eq. > @ arr.at -5 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-out-of-tuple-bounds-with-negative-index +[] > tests-throws-on-out-of-tuple-bounds-with-negative-index * 0 1 2 3 4 > arr arr.at -6 > @ diff --git a/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo index 62c12f9c4f..0dca8dd5d0 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo @@ -28,15 +28,15 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > matches-regex-against-the-pattern +[] > tests-matches-regex-against-the-pattern (regex "/[a-z]+/").compiled.matches "hello" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-matches-regex-against-the-pattern +[] > tests-does-not-matches-regex-against-the-pattern ((regex "/[a-z]+/").compiled.matches "123").not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > matched-sequence-has-right-border-indexes +[] > tests-matched-sequence-has-right-border-indexes ((regex "/[a-z]+/").match "!hello!").next > n and. > @ 0.eq n.start @@ -45,11 +45,11 @@ 6.eq n.to # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-returns-valid-matched-string-sequence +[] > tests-regex-returns-valid-matched-string-sequence ((regex "/[a-z]+/").match "!hello!").next.text.eq "hello" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-returns-valid-second-matched-block +[] > tests-regex-returns-valid-second-matched-block ((regex "/[a-z]+/").match "!hello!world!").next.next > second and. > @ and. @@ -62,35 +62,35 @@ second.to.eq 12 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-next-on-not-matched-block +[] > tests-throws-on-getting-next-on-not-matched-block ((regex "/[a-z]+/").match "123").next.next > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-from-position-on-not-matched-block +[] > tests-throws-on-getting-from-position-on-not-matched-block ((regex "/[a-z]+/").match "123").next.from > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-to-position-on-not-matched-block +[] > tests-throws-on-getting-to-position-on-not-matched-block ((regex "/[a-z]+/").match "123").next.to > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-groups-count-on-not-matched-block +[] > tests-throws-on-getting-groups-count-on-not-matched-block ((regex "/[a-z]+/").match "123").next.groups-count > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-groups-on-not-matched-block +[] > tests-throws-on-getting-groups-on-not-matched-block ((regex "/[a-z]+/").match "123").next.groups > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-specified-group-on-not-matched-block +[] > tests-throws-on-getting-specified-group-on-not-matched-block ((regex "/[a-z]+/").match "123").next.group 1 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-getting-text-on-not-matched-block +[] > tests-throws-on-getting-text-on-not-matched-block ((regex "/[a-z]+/").match "123").next.text > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-dotall-option +[] > tests-regex-matches-dotall-option regex "/(.*)/s" .compiled @@ -98,7 +98,7 @@ "too \\n many \\n line \\n Feed\\n" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-with-case-insensitive-option +[] > tests-regex-matches-with-case-insensitive-option regex "/(string)/i" .compiled @@ -106,7 +106,7 @@ "StRiNg" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-with-multiline-option +[] > tests-regex-matches-with-multiline-option regex "/(^([0-9]+).*)/m" .compiled @@ -114,7 +114,7 @@ "1 bottle of water on the wall. \\n1 bottle of water." # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-entire-pattern +[] > tests-regex-matches-entire-pattern regex "/[0-9]/\\d+/" .compiled @@ -122,7 +122,7 @@ "2/75" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-with-regex-unix-lines +[] > tests-regex-matches-with-regex-unix-lines regex "/(.+)/d" .compiled @@ -130,7 +130,7 @@ "A\\r\\nB\\rC\\nD" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-with-regex-case-insensitive-and-caps +[] > tests-regex-matches-with-regex-case-insensitive-and-caps regex "/(word)/i" .compiled @@ -138,7 +138,7 @@ "WORD" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-ignores-comments-in-string +[] > tests-regex-ignores-comments-in-string regex "/(\\d) #ignore this comment/x" .compiled @@ -146,7 +146,7 @@ "4" # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-matches-with-unicode-case-and-insensitive +[] > tests-regex-matches-with-unicode-case-and-insensitive regex "/(yildirim)/ui" .compiled @@ -154,11 +154,11 @@ "Yıldırım" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-missing-first-slash-in-regex +[] > tests-throws-on-missing-first-slash-in-regex (regex "(.)+").compiled > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > regex-contains-valid-groups-on-each-matched-block +[] > tests-regex-contains-valid-groups-on-each-matched-block ((regex "/([a-z]+)([1-9]{1})/").compiled.match "!hello1!world2").next > first first.next > second and. > @ diff --git a/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo index 709db16f26..97f6963ee0 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo @@ -28,7 +28,7 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > prints-simple-string +[] > tests-prints-simple-string eq. > @ "Hello, Jeffrey!" sprintf @@ -36,7 +36,7 @@ * "Jeffrey" # This unit test is supposed to check the functionality of the corresponding object. -[] > prints-complex-string +[] > tests-prints-complex-string eq. > @ "Привет 3.140000 Jeff X!" sprintf @@ -44,7 +44,7 @@ * 3.14 "Jeff" "X" # This unit test is supposed to check the functionality of the corresponding object. -[] > prints-bytes-string +[] > tests-prints-bytes-string eq. > @ "40-45-00-00-00-00-00-00" sprintf @@ -52,7 +52,7 @@ * 42.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > formats-all-objects +[] > tests-formats-all-objects eq. > @ "string Jeff, bytes 4A-65-66-66, float 42.300000, int 14, bool false" sprintf @@ -60,13 +60,13 @@ * "Jeff" "Jeff".as-bytes 42.3 14 false # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-sprintf-with-arguments-that-does-not-match +[] > tests-throws-on-sprintf-with-arguments-that-does-not-match sprintf > @ "%s%s" * "Jeff" # This unit test is supposed to check the functionality of the corresponding object. -[] > sprintf-does-not-fail-if-arguments-more-than-formats +[] > tests-sprintf-does-not-fail-if-arguments-more-than-formats eq. > @ "Hey" sprintf @@ -74,11 +74,11 @@ * "Hey" "Jeff" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-sprintf-unsupported-format +[] > tests-throws-on-sprintf-unsupported-format sprintf "%o" * > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > sprintf-prints-percents +[] > tests-sprintf-prints-percents eq. > @ "%Jeff" sprintf @@ -86,7 +86,7 @@ * "Jeff" # This unit test is supposed to check the functionality of the corresponding object. -[] > sprintf-does-not-print-i64 +[] > tests-sprintf-does-not-print-i64 not. > @ eq. sprintf @@ -95,7 +95,7 @@ "42" # This unit test is supposed to check the functionality of the corresponding object. -[] > sprintf-prints-i64-as-number +[] > tests-sprintf-prints-i64-as-number eq. > @ "42" sprintf diff --git a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo index 0fd3c2cb3b..26477de72c 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo @@ -30,32 +30,32 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-string +[] > tests-sscanf-with-string eq. > @ "hello" value. sscanf "%s" "hello" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-int +[] > tests-sscanf-with-int eq. > @ 33 value. sscanf "%d" "33" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-float +[] > tests-sscanf-with-float eq. > @ 0.24 value. sscanf "%f" "0.24" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-sscanf-with-wrong-format +[] > tests-throws-on-sscanf-with-wrong-format sscanf "%l" "error" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-string-int-float +[] > tests-sscanf-with-string-int-float eq. > @ list sscanf @@ -64,35 +64,35 @@ * "hello" 33 0.24 # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-string-with-ending +[] > tests-sscanf-with-string-with-ending eq. > @ "hello" value. sscanf "%s!" "hello!" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-complex-string +[] > tests-sscanf-with-complex-string eq. > @ "test" value. sscanf "some%sstring" "someteststring" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-complex-int +[] > tests-sscanf-with-complex-int eq. > @ 734987259 value. sscanf "!%d!" "!734987259!" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-complex-float +[] > tests-sscanf-with-complex-float eq. > @ 1991.01 value. sscanf "this will be=%f" "this will be=1991.01" # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-with-sprintf +[] > tests-sscanf-with-sprintf eq. > @ list sscanf @@ -103,7 +103,7 @@ * "This" 8 # This unit test is supposed to check the functionality of the corresponding object. -[] > sscanf-complex-case +[] > tests-sscanf-complex-case eq. > @ list sscanf diff --git a/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo index 58f47e59c6..97be9e3e4a 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo @@ -30,119 +30,119 @@ +version 0.0.0 # This unit test is supposed to check the functionality of the corresponding object. -[] > text-slices-the-origin-string +[] > tests-text-slices-the-origin-string eq. > @ (text "Hello, world!").slice 7 5 "world" # This unit test is supposed to check the functionality of the corresponding object. -[] > trimmed-left-empty-text +[] > tests-trimmed-left-empty-text eq. > @ (text "").trimmed-left "" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-left-one-space +[] > tests-text-trimmed-left-one-space eq. > @ (text " s").trimmed-left "s" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-left-many-spaces +[] > tests-text-trimmed-left-many-spaces eq. > @ (text " some").trimmed-left "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-left-only-spaces +[] > tests-text-trimmed-left-only-spaces eq. > @ (text " ").trimmed-left "" # This unit test is supposed to check the functionality of the corresponding object. -[] > trimmed-right-empty-text +[] > tests-trimmed-right-empty-text eq. > @ (text "").trimmed-right "" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-right-one-space +[] > tests-text-trimmed-right-one-space eq. > @ (text "s ").trimmed-right "s" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-right-many-spaces +[] > tests-text-trimmed-right-many-spaces eq. > @ (text "some ").trimmed-right "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-right-only-spaces +[] > tests-text-trimmed-right-only-spaces eq. > @ (text " ").trimmed-right "" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-one-space-left +[] > tests-text-trimmed-one-space-left eq. > @ (text " some").trimmed "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-one-space-right +[] > tests-text-trimmed-one-space-right eq. > @ (text "some ").trimmed "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-one-space-both +[] > tests-text-trimmed-one-space-both eq. > @ (text " some ").trimmed "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-many-spaces +[] > tests-text-trimmed-many-spaces eq. > @ (text " some ").trimmed "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-empty +[] > tests-text-trimmed-empty eq. > @ (text "").trimmed "" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-trimmed-only-spaces +[] > tests-text-trimmed-only-spaces eq. > @ (text " ").trimmed "" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-first-char +[] > tests-returns-first-char eq. > @ "s" (text "some").at 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-third-char +[] > tests-returns-third-char eq. > @ "m" (text "some").at 2 # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-char-at-negative-index +[] > tests-returns-char-at-negative-index eq. > @ "m" (text "some").at -2 # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-text-at-index-more-than-length +[] > tests-throws-on-text-at-index-more-than-length (text "some").at 10 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > chains-with-other-strings +[] > tests-chains-with-other-strings eq. > @ "Hello, world!" chained. @@ -153,7 +153,7 @@ "!" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-same-text-on-chaining-with-no-strings +[] > tests-returns-same-text-on-chaining-with-no-strings eq. > @ "Some" chained. @@ -161,55 +161,55 @@ * # This unit test is supposed to check the functionality of the corresponding object. -[] > joined-no-strings +[] > tests-joined-no-strings eq. > @ "" (text "-").joined * # This unit test is supposed to check the functionality of the corresponding object. -[] > joined-one-string +[] > tests-joined-one-string eq. > @ "some" (text "-").joined * "some" # This unit test is supposed to check the functionality of the corresponding object. -[] > joined-many-strings +[] > tests-joined-many-strings eq. > @ "hello-world-dear-friend" (text "-").joined * "hello" "world" "dear" "friend" # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-text-repeating-less-than-zero-times +[] > tests-throws-on-text-repeating-less-than-zero-times (text "").repeated -1 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > text-repeated-zero-times-is-empty +[] > tests-text-repeated-zero-times-is-empty eq. > @ "" (text "some").repeated 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > text-repeated-five-times +[] > tests-text-repeated-five-times eq. > @ "heyheyheyheyhey" (text "hey").repeated 5 # This unit test is supposed to check the functionality of the corresponding object. -[] > index-of-non-existed-substring-with-more-length +[] > tests-index-of-non-existed-substring-with-more-length eq. > @ -1 (text "Hello").index-of "Somebody" # This unit test is supposed to check the functionality of the corresponding object. -[] > index-of-non-existed-substring-with-same-length +[] > tests-index-of-non-existed-substring-with-same-length eq. > @ -1 (text "Hello").index-of "world" # This unit test is supposed to check the functionality of the corresponding object. -[] > index-of-non-existed-substring-with-utf +[] > tests-index-of-non-existed-substring-with-utf eq. > @ -1 index-of. @@ -217,7 +217,7 @@ "x" # This unit test is supposed to check the functionality of the corresponding object. -[] > index-of-existed-substring-with-utf +[] > tests-index-of-existed-substring-with-utf eq. > @ 3 index-of. @@ -225,7 +225,7 @@ "в" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-index-of-substring +[] > tests-returns-valid-index-of-substring eq. > @ 6 index-of. @@ -233,58 +233,58 @@ "\n" # This unit test is supposed to check the functionality of the corresponding object. -[] > returns-valid-index-of-substring-in-the-end +[] > tests-returns-valid-index-of-substring-in-the-end eq. > @ 6 (text "Hello world").index-of "world" # This unit test is supposed to check the functionality of the corresponding object. -[] > starts-with-substring +[] > tests-starts-with-substring (text "Hello, world").starts-with "Hello" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-start-with-substring +[] > tests-does-not-start-with-substring not. > @ (text "Hello, world").starts-with "world" # This unit test is supposed to check the functionality of the corresponding object. -[] > ends-with-substring +[] > tests-ends-with-substring (text "Hello world!").ends-with "world!" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-end-with-substring +[] > tests-does-not-end-with-substring not. > @ (text "Hello world!").ends-with "Hello" # This unit test is supposed to check the functionality of the corresponding object. -[] > text-contains-substring +[] > tests-text-contains-substring (text "Hello, world!").contains "o, wo" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > text-does-not-contain-substring +[] > tests-text-does-not-contain-substring not. > @ (text "Hello, world!").contains "Hey" # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-last-index-of-substring +[] > tests-finds-last-index-of-substring eq. > @ 5 (text "Hey, Hey, Hey").last-index-of "Hey," # This unit test is supposed to check the functionality of the corresponding object. -[] > finds-last-index-of-the-same-string +[] > tests-finds-last-index-of-the-same-string eq. > @ 0 (text "Hello").last-index-of "Hello" # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-non-existed-substring +[] > tests-last-index-of-non-existed-substring eq. > @ -1 (text "Hello, world").last-index-of "somebody" # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-non-existed-substring-with-utf +[] > tests-last-index-of-non-existed-substring-with-utf eq. > @ -1 last-index-of. @@ -292,7 +292,7 @@ "x" # This unit test is supposed to check the functionality of the corresponding object. -[] > last-index-of-existed-substring-with-utf +[] > tests-last-index-of-existed-substring-with-utf eq. > @ 3 last-index-of. @@ -300,27 +300,27 @@ "в" # This unit test is supposed to check the functionality of the corresponding object. -[] > splits-text-by-dash +[] > tests-splits-text-by-dash eq. > @ list (text "a-b-c").split "-" * "a" "b" "c" # This unit test is supposed to check the functionality of the corresponding object. -[] > splits-text-with-empty-strings +[] > tests-splits-text-with-empty-strings eq. > @ list (text "-a-b-").split "-" * "" "a" "b" "" # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-text-to-upper-case +[] > tests-converts-text-to-upper-case eq. > @ "HELLO" (text "hello").up-cased # This unit test is supposed to check the functionality of the corresponding object. -[] > splits-and-returns-strings +[] > tests-splits-and-returns-strings eq. > @ length. at. @@ -331,99 +331,99 @@ 6 # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-text-with-upper-letters-to-upper-case +[] > tests-converts-text-with-upper-letters-to-upper-case eq. > @ "HELLO" (text "HeLlO").up-cased # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-text-to-lower-case +[] > tests-converts-text-to-lower-case eq. > @ "hello" (text "HELLO").low-cased # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-text-with-low-letters-to-lower-case +[] > tests-converts-text-with-low-letters-to-lower-case eq. > @ "hello" (text "HeLlO").low-cased # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-text-to-number +[] > tests-converts-text-to-number eq. > @ 5 (text "5").as-number # This unit test is supposed to check the functionality of the corresponding object. -[] > throws-on-converting-text-to-number +[] > tests-throws-on-converting-text-to-number (text "Hello").as-number > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > converts-float-text-to-number +[] > tests-converts-float-text-to-number eq. > @ 3.14 (text "3.14").as-number # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-text-is-ascii +[] > tests-checks-if-text-is-ascii is-ascii. > @ text "H311oW" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-emoji-is-not-ascii +[] > tests-checks-if-emoji-is-not-ascii not. > @ is-ascii. text "🌵" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-string-of-numbers-is-ascii +[] > tests-checks-if-string-of-numbers-is-ascii is-ascii. > @ text "123" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-simple-text-is-alphanumeric +[] > tests-checks-if-simple-text-is-alphanumeric is-alphanumeric. > @ text "eEo" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-text-with-number-is-alphanumeric +[] > tests-checks-if-text-with-number-is-alphanumeric is-alphanumeric. > @ text "ab3d" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-text-with-dashes-is-not-alphanumeric +[] > tests-checks-if-text-with-dashes-is-not-alphanumeric not. > @ is-alphanumeric. text "-w-" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-simple-text-is-alpha +[] > tests-checks-if-simple-text-is-alpha is-alpha. > @ text "eEo" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-text-with-number-is-not-alpha +[] > tests-checks-if-text-with-number-is-not-alpha not. > @ is-alpha. text "ab3d" # This unit test is supposed to check the functionality of the corresponding object. -[] > checks-if-text-with-dashes-is-not-alpha +[] > tests-checks-if-text-with-dashes-is-not-alpha not. > @ is-alpha. text "-w-" # This unit test is supposed to check the functionality of the corresponding object. -[] > does-not-replaces-if-regex-not-found +[] > tests-does-not-replaces-if-regex-not-found text "Hello, world" .replaced @@ -434,7 +434,7 @@ "Hello, world" # This unit test is supposed to check the functionality of the corresponding object. -[] > replaces-digits-with-string +[] > tests-replaces-digits-with-string text "Hell0, w0rld" .replaced @@ -445,7 +445,7 @@ "Hello, world" # This unit test is supposed to check the functionality of the corresponding object. -[] > replaces-slashes-to-windows-separator +[] > tests-replaces-slashes-to-windows-separator text "C:\\Windows/foo\\bar/hello.txt" .replaced @@ -456,7 +456,7 @@ "C:\\Windows\\foo\\bar\\hello.txt" # This unit test is supposed to check the functionality of the corresponding object. -[] > replaces-windows-path-with-slash +[] > tests-replaces-windows-path-with-slash text "C:\\Windows\\Users\\AppLocal\\shrek" .replaced @@ -467,7 +467,7 @@ "C/Windows/Users/AppLocal/shrek" # This unit test is supposed to check the functionality of the corresponding object. -[] > sanitizes-windows-path-with-regex +[] > tests-sanitizes-windows-path-with-regex text "foo\\bar<:>?*\"|baz\\asdf" .replaced diff --git a/eo-runtime/src/test/eo/org/eolang/while-tests.eo b/eo-runtime/src/test/eo/org/eolang/while-tests.eo index 85c84f7e01..51351b294f 100644 --- a/eo-runtime/src/test/eo/org/eolang/while-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/while-tests.eo @@ -28,7 +28,7 @@ +unlint broken-ref # This unit test is supposed to check the functionality of the corresponding object. -[] > while-dataizes-only-first-cycle +[] > tests-while-dataizes-only-first-cycle eq. > @ 0 malloc.for @@ -39,14 +39,14 @@ m.put i > [i] >> # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-while-with-false-first +[] > tests-simple-while-with-false-first not. > @ while > res false > [i] true > [i] # This unit test is supposed to check the functionality of the corresponding object. -[] > simple-bool-expression-via-malloc-in-while +[] > tests-simple-bool-expression-via-malloc-in-while eq. > @ malloc.for true @@ -57,7 +57,7 @@ false # This unit test is supposed to check the functionality of the corresponding object. -[] > last-while-dataization-object +[] > tests-last-while-dataization-object eq. > @ malloc.for 0 @@ -68,14 +68,14 @@ 3 # This unit test is supposed to check the functionality of the corresponding object. -[] > last-while-dataization-object-with-false-condition +[] > tests-last-while-dataization-object-with-false-condition not. > @ while 1.gt 2 > [i] true > [i] # This unit test is supposed to check the functionality of the corresponding object. -[] > while-simple-iteration +[] > tests-while-simple-iteration eq. > @ malloc.for 0 @@ -86,7 +86,7 @@ 9 # This unit test is supposed to check the functionality of the corresponding object. -[] > iterating-tuple-with-while-using-internal-iterator +[] > tests-iterating-tuple-with-while-using-internal-iterator * 1 1 1 1 > arr arr.length.plus -1 > max malloc.for > data @@ -113,7 +113,7 @@ data.eq arr.length > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > iterating-tuple-with-while-using-external-iterator +[] > tests-iterating-tuple-with-while-using-external-iterator * 1 1 1 1 > arr arr.length.plus -1 > max malloc.for > data @@ -135,7 +135,7 @@ data.eq arr.length > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > iterating-tuple-with-while-without-body-multiple +[] > tests-iterating-tuple-with-while-without-body-multiple * 1 1 1 > arr arr.length > max malloc.for > data @@ -165,7 +165,7 @@ data.eq arr.length > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > iterating-tuple-with-while-without-body-single +[] > tests-iterating-tuple-with-while-without-body-single * 1 > arr arr.length > max malloc.for > data From ebccec30eb391f99a259041a7a3d35561fba5e59 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 22 Jan 2025 21:36:23 +0300 Subject: [PATCH 16/23] #3797: names --- .../src/test/eo/org/eolang/math/real-tests.eo | 28 +++++++++---------- .../src/test/eo/org/eolang/string-tests.eo | 14 +++++----- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo index 747d7f9a84..10ab92ce5c 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo @@ -60,31 +60,31 @@ 17.9 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-mod-1-2 +[] > tests-mod-n1-n2 eq. > @ (real 1).mod 2 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-mod-0-5 +[] > tests-mod-n0-n5 eq. > @ (real 0).mod 5 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-mod-0-15-neg +[] > tests-mod-n0-n15-neg eq. > @ (real 0).mod -15 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-mod-1-neg-7 +[] > tests-mod-n1-neg-n7 eq. > @ (real -1).mod 7 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-mod-16-200-neg +[] > tests-mod-n16-n200-neg eq. > @ (real 16).mod -200 16 @@ -412,14 +412,14 @@ real nan # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-sqrt-check-infinity-1 +[] > tests-sqrt-check-infinity-n1 eq. > @ sqrt. real positive-infinity positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-sqrt-check-infinity-2 +[] > tests-sqrt-check-infinity-n2 is-nan. > @ sqrt. real negative-infinity @@ -535,7 +535,7 @@ (real -2.0).acos # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-0 +[] > tests-exp-check-n0 lt. > @ abs. real @@ -545,7 +545,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-1 +[] > tests-exp-check-n1 lt. > @ abs. real @@ -555,7 +555,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-2 +[] > tests-exp-check-n2 lt. > @ abs. real @@ -565,7 +565,7 @@ 0.00000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-3 +[] > tests-exp-check-n3 lt. > @ abs. real @@ -575,7 +575,7 @@ 0.0000001 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-4 +[] > tests-exp-check-n4 lt. > @ abs. real @@ -590,13 +590,13 @@ (real nan).exp # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-infinity-1 +[] > tests-exp-check-infinity-n1 eq. > @ (real positive-infinity).exp positive-infinity # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-exp-check-infinity-2 +[] > tests-exp-check-infinity-n2 eq. > @ (real negative-infinity).exp 0 diff --git a/eo-runtime/src/test/eo/org/eolang/string-tests.eo b/eo-runtime/src/test/eo/org/eolang/string-tests.eo index 2f45405e4d..e29b5b91ae 100644 --- a/eo-runtime/src/test/eo/org/eolang/string-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/string-tests.eo @@ -51,21 +51,21 @@ D0-B4-D1-80-D1-83-D0-B3 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-reads-the-length-with-2-byte-characters +[] > tests-reads-the-length-with-n2-byte-characters "Hello, друг!" > str and. > @ str.length.eq 12 str.as-bytes.size.eq 16 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-reads-the-length-with-3-byte-characters +[] > tests-reads-the-length-with-n3-byte-characters "The अ devanagari" > str and. > @ str.length.eq 16 str.as-bytes.size.eq 18 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-reads-the-length-with-4-byte-characters +[] > tests-reads-the-length-with-n4-byte-characters "The 😀 smile" > str and. > @ str.length.eq 11 @@ -74,7 +74,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # The smile emoji is F0-9F-98-80 in bytes. Here we check if string.length fails if it faces # incomplete 4 byte character. -[] > tests-throws-on-taking-length-of-incomplete-4-byte-character +[] > tests-throws-on-taking-length-of-incomplete-n4-byte-character string F0-9F-98 > should-be-smile should-be-smile.length > @ @@ -237,19 +237,19 @@ "Ф" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-slice-with-2-byte-characters +[] > tests-slice-with-n2-byte-characters eq. > @ "привет".slice 1 2 "ри" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-slice-with-3-byte-characters +[] > tests-slice-with-n3-byte-characters eq. > @ "The अ is अ".slice 1 6 "he अ i" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-slice-with-4-byte-characters +[] > tests-slice-with-n4-byte-characters eq. > @ "One 😀 and 😀 another".slice 3 8 " 😀 and 😀" From ad602ccd1585cb3099f833cc619cc044c58c6536 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 23 Jan 2025 14:15:55 +0300 Subject: [PATCH 17/23] #3797: master From 27dd5eccfbe23827d306fc5fd91f98e682b8fa3e Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Tue, 4 Feb 2025 08:47:25 +0300 Subject: [PATCH 18/23] #3797: more --- eo-maven-plugin/pom.xml | 4 ++-- eo-runtime/src/test/eo/org/eolang/bytes-tests.eo | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 022581747b..36cc4fe305 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.36 + 1.0-SNAPSHOT org.glassfish @@ -204,7 +204,7 @@ SOFTWARE. com.yegor256 tojos - 0.18.4 + 0.18.5 javax.json diff --git a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo index 4ae47aeafa..8a24da6efc 100644 --- a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo @@ -75,11 +75,10 @@ -3.as-bytes # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-left-with-odd-neg - not. > @ - eq. - -17.as-bytes.left 1 - 33.as-bytes +not. > tests-left-with-odd-neg + eq. + -17.as-bytes.left 1 + 33.as-bytes # This unit test is supposed to check the functionality of the corresponding object. [] > tests-left-with-minus-one From ef159e2c188ac14b9fae85a6915ad2014d2482e2 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Wed, 5 Feb 2025 15:46:28 +0300 Subject: [PATCH 19/23] #3797: up --- eo-maven-plugin/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 30f038b616..9859644bb8 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 1.0-SNAPSHOT + 0.0.37 org.glassfish From 115918856d848cd25d44d7ab4faeb2f3ff4dcbc7 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 6 Feb 2025 13:17:36 +0300 Subject: [PATCH 20/23] #3797: up --- eo-maven-plugin/pom.xml | 2 +- eo-parser/src/test/resources/log4j.properties | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/eo-maven-plugin/pom.xml b/eo-maven-plugin/pom.xml index 9859644bb8..a65f55a16c 100644 --- a/eo-maven-plugin/pom.xml +++ b/eo-maven-plugin/pom.xml @@ -42,7 +42,7 @@ SOFTWARE. org.eolang lints - 0.0.37 + 0.0.38 org.glassfish diff --git a/eo-parser/src/test/resources/log4j.properties b/eo-parser/src/test/resources/log4j.properties index aa662f6aa2..cb14ff4e20 100644 --- a/eo-parser/src/test/resources/log4j.properties +++ b/eo-parser/src/test/resources/log4j.properties @@ -26,10 +26,5 @@ log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=com.jcabi.log.MulticolorLayout log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss} [%color{%p}] %c: %m%n -log4j.logger.org.eolang.parser.StrictXmir=ERROR -log4j.logger.com.jcabi.log=WARN -log4j.logger.com.yegor256.xsline=WARN -log4j.logger.com.yegor256.xsline.StSchema=DEBUG -log4j.logger.org.eolang=WARN -log4j.logger.org.eolang.parser.XmirTest=WARN -log4j.logger.org.eolang.parser.CheckPack=INFO +log4j.logger.com.jcabi.xml=OFF +log4j.logger.org.eolang=OFF From b081124330095e9fa4550da863072d064d15ea3b Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 6 Feb 2025 13:19:04 +0300 Subject: [PATCH 21/23] #3797: merge --- .codacy.yml | 2 +- .../java/org/eolang/maven/AssembleMojo.java | 197 +--------------- .../java/org/eolang/maven/CompileMojo.java | 62 +++++ .../org/eolang/maven/DownloadDepsMojo.java | 11 - .../main/java/org/eolang/maven/MarkMojo.java | 1 - .../main/java/org/eolang/maven/ParseMojo.java | 13 -- .../main/java/org/eolang/maven/PlaceMojo.java | 41 ---- .../main/java/org/eolang/maven/ProbeMojo.java | 10 - .../main/java/org/eolang/maven/PullMojo.java | 17 -- .../java/org/eolang/maven/ResolveMojo.java | 64 ------ .../main/java/org/eolang/maven/SafeMojo.java | 134 +++++++++++ eo-runtime/pom.xml | 8 +- .../src/test/java/integration/PhiUnphiIT.java | 213 ++++++++++++++++++ 13 files changed, 424 insertions(+), 349 deletions(-) create mode 100644 eo-maven-plugin/src/main/java/org/eolang/maven/CompileMojo.java create mode 100644 eo-runtime/src/test/java/integration/PhiUnphiIT.java diff --git a/.codacy.yml b/.codacy.yml index 51be5c0b14..d5ed85e160 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -26,4 +26,4 @@ --- exclude_paths: - "src/test/groovy/*.groovy" - - "eo-runtime/src/main/java/EOorg/EOeolang/EOmalloc$EOof$EOallocated$EOresized.java" + - "eo-runtime/src/test/java/integration/PhiUnphiIT.java" diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java index 45cb664c13..00d0650ddc 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/AssembleMojo.java @@ -24,41 +24,20 @@ package org.eolang.maven; import com.jcabi.log.Logger; -import java.io.File; -import java.nio.file.Path; -import java.util.Set; -import java.util.function.BiConsumer; -import org.apache.maven.model.Dependency; -import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.cactoos.set.SetOf; /** * Pull all necessary EO XML files from Objectionary and parse them all. * * @since 0.1 - * @todo #2406:90min Make up with idea how to get rid of duplicate parameters between mojos. - * There's a situation where AssembleMojo owns, creates and executes other mojos, - * like {@link ParseMojo} or {@link ShakeMojo}. When we configure our compiler via pom.xml maven - * tries to set parameters directly to the calling mojo. That's why we must to have all parameters - * from child mojos in AssembleMojo or {@link SafeMojo} (in order they won't be skipped and lost). - * That causes duplication of parameters between "parent" mojo and "child" mojos. - * Also it obliges the developer to remember that if he adds new parameter to some child mojo, - * this parameter must be present in parent mojo as well. - * We didn't find a way how we can resolve such duplication at the moment. - * So we need to either accept this as impossible to solve or resolve somehow. - * Anyway don't forget to remove the puzzle when the decision about the puzzle is made. */ @Mojo( name = "assemble", defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true ) -@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.TooManyFields"}) public final class AssembleMojo extends SafeMojo { - /** * The intermediate representation extension. */ @@ -70,180 +49,26 @@ public final class AssembleMojo extends SafeMojo { public static final String EO = "eo"; /** - * Output. - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter( - property = "eo.outputDir", - required = true, - defaultValue = "${project.build.outputDirectory}" - ) - private File outputDir; - - /** - * List of inclusion GLOB filters for finding class files. - * @since 0.15 - * @checkstyle MemberNameCheck (7 lines) - * @checkstyle ConstantUsageCheck (5 lines) - */ - @Parameter - private final Set includeBinaries = new SetOf<>("**"); - - /** - * List of exclusion GLOB filters for finding class files. - * @since 0.15 - * @checkstyle MemberNameCheck (7 lines) - * @checkstyle ConstantUsageCheck (5 lines) - */ - @Parameter - private final Set excludeBinaries = new SetOf<>(); - - /** - * The central. - */ - @SuppressWarnings("PMD.ImmutableField") - private BiConsumer central; - - /** - * Pull again even if the .eo file is already present? - * @since 0.10.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.overWrite", required = true, defaultValue = "false") - private boolean overWrite; - - /** - * Track optimization steps into intermediate XML files? - * - * @since 0.24.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @SuppressWarnings("PMD.LongVariable") - @Parameter(property = "eo.trackTransformationSteps", required = true, defaultValue = "false") - private boolean trackTransformationSteps; - - /** - * The Git tag to pull objects from, in objectionary. - * @since 0.21.0 - */ - @SuppressWarnings("PMD.ImmutableField") - @Parameter(property = "eo.tag", required = true, defaultValue = "master") - private String tag = "master"; - - /** - * Skip artifact with the version 0.0.0. - * @since 0.9.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.skipZeroVersions", required = true, defaultValue = "true") - private boolean skipZeroVersions; - - /** - * Shall we discover JAR artifacts for .EO sources? - * @since 0.12.0 - * @checkstyle MemberNameCheck (7 lines) + * Mojas to execute. */ - @Parameter(property = "eo.discoverSelf", required = true, defaultValue = "false") - private boolean discoverSelf; - - /** - * Fail resolution process on conflicting dependencies. - * - * @since 0.1.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreVersionConflicts", required = true, defaultValue = "false") - @SuppressWarnings("PMD.LongVariable") - private boolean ignoreVersionConflicts; - - /** - * Whether we should fail on warn. - * @checkstyle MemberNameCheck (10 lines) - */ - @SuppressWarnings("PMD.ImmutableField") - @Parameter( - property = "eo.failOnWarning", - required = true, - defaultValue = "false" - ) - private boolean failOnWarning; - - /** - * Fail resolution process on transitive dependencies. - * - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreTransitive", required = true, defaultValue = "false") - @SuppressWarnings("PMD.ImmutableField") - private boolean ignoreTransitive; - - /** - * Add eo-runtime dependency to the classpath. - * - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreRuntime", required = true, defaultValue = "true") - @SuppressWarnings({"PMD.ImmutableField", "PMD.LongVariable"}) - private boolean withRuntimeDependency = true; - - /** - * If set to TRUE, the exception on exit will be printed in details - * to the log. - * @since 0.29.0 - * @checkstyle MemberNameCheck (7 lines) - * @checkstyle VisibilityModifierCheck (10 lines) - */ - @Parameter(property = "eo.unrollExitError") - @SuppressWarnings("PMD.ImmutableField") - private boolean unrollExitError = true; - - /** - * The current version of eo-maven-plugin. - * Maven 3 only. - * It is the predefined maven property as MavenProject, MavenSession, MojoExecution, etc. - * You can read more about that property - * here. - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(defaultValue = "${plugin}", readonly = true) - private PluginDescriptor plugin; - - /** - * Place only binaries that have EO sources inside jar. - * @since 0.31 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter - @SuppressWarnings("PMD.LongVariable") - private boolean placeBinariesThatHaveSources; - - /** - * Pull objects from objectionary or not. - * @since 0.32.0 - */ - @Parameter(property = "eo.offline", required = true, defaultValue = "false") - private boolean offline; + private static final Moja[] MOJAS = { + new Moja<>(ParseMojo.class), + new Moja<>(ShakeMojo.class), + new Moja<>(ProbeMojo.class), + new Moja<>(PullMojo.class), + new Moja<>(ResolveMojo.class), + new Moja<>(MarkMojo.class), + new Moja<>(PlaceMojo.class), + }; @Override public void exec() { final long begin = System.currentTimeMillis(); - if (this.central == null) { - this.central = new Central(this.project, this.session, this.manager); - } String before = this.scopedTojos().status(); int cycle = 0; - final Moja[] mojas = { - new Moja<>(ParseMojo.class), - new Moja<>(ShakeMojo.class), - new Moja<>(ProbeMojo.class), - new Moja<>(PullMojo.class), - new Moja<>(ResolveMojo.class), - new Moja<>(MarkMojo.class), - new Moja<>(PlaceMojo.class), - }; while (true) { final long start = System.currentTimeMillis(); - for (final Moja moja : mojas) { + for (final Moja moja : AssembleMojo.MOJAS) { moja.copy(this).execute(); } final String after = this.scopedTojos().status(); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/CompileMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/CompileMojo.java new file mode 100644 index 0000000000..0a4312e121 --- /dev/null +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/CompileMojo.java @@ -0,0 +1,62 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2016-2025 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; + +import com.jcabi.log.Logger; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + +/** + * Compile and lint all EO files. + * + * @since 0.52 + */ +@Mojo( + name = "compile", + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + threadSafe = true +) +public final class CompileMojo extends SafeMojo { + /** + * Mojas to execute. + */ + private static final Moja[] MOJAS = { + new Moja<>(DownloadDepsMojo.class), + new Moja<>(AssembleMojo.class), + new Moja<>(LintMojo.class), + }; + + @Override + public void exec() { + final long begin = System.currentTimeMillis(); + for (final Moja moja : CompileMojo.MOJAS) { + moja.copy(this).execute(); + } + Logger.info( + this, + "Compilation process took %[ms]s", + System.currentTimeMillis() - begin + ); + } +} diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/DownloadDepsMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/DownloadDepsMojo.java index 36a60c18c8..f0fe076279 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/DownloadDepsMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/DownloadDepsMojo.java @@ -24,9 +24,7 @@ package org.eolang.maven; import java.io.IOException; -import java.nio.file.Path; import java.util.Collection; -import java.util.function.BiConsumer; import java.util.function.Supplier; import org.apache.maven.model.Dependency; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -52,17 +50,8 @@ public final class DownloadDepsMojo extends SafeMojo { new DepFunc("net.java.dev.jna", "jna", "5.14.0") ); - /** - * The central. - */ - @SuppressWarnings("PMD.ImmutableField") - private BiConsumer central; - @Override void exec() throws IOException { - if (this.central == null) { - this.central = new Central(this.project, this.session, this.manager); - } for (final Supplier dep : DownloadDepsMojo.DEPS) { this.central.accept(dep.get(), this.classesDir.toPath()); } diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/MarkMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/MarkMojo.java index 83c091304a..efd62ddaa4 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/MarkMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/MarkMojo.java @@ -47,7 +47,6 @@ threadSafe = true ) public final class MarkMojo extends SafeMojo { - @Override public void exec() throws IOException { final Path home = this.targetDir.toPath().resolve(ResolveMojo.DIR); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java index 120bdbcace..57a4f8c9a1 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java @@ -29,10 +29,8 @@ import java.io.IOException; import java.nio.file.Path; import java.util.List; -import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.cactoos.Func; import org.cactoos.io.InputOf; @@ -56,7 +54,6 @@ threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE ) -@SuppressWarnings("PMD.ImmutableField") public final class ParseMojo extends SafeMojo { /** @@ -74,16 +71,6 @@ public final class ParseMojo extends SafeMojo { */ public static final String CACHE = "parsed"; - /** - * The current version of eo-maven-plugin. - * Maven 3 only. - * You can read more about that property - * here. - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(defaultValue = "${plugin}", readonly = true) - private PluginDescriptor plugin; - @Override public void exec() { final long start = System.currentTimeMillis(); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PlaceMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PlaceMojo.java index d1d2445218..b4523b1d51 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PlaceMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PlaceMojo.java @@ -32,13 +32,10 @@ import java.util.Collection; import java.util.Objects; import java.util.Optional; -import java.util.Set; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.cactoos.io.InputOf; import org.cactoos.scalar.Unchecked; -import org.cactoos.set.SetOf; import org.eolang.maven.tojos.PlacedTojo; import org.eolang.maven.util.HmBase; import org.eolang.maven.util.HmOptional; @@ -56,45 +53,7 @@ defaultPhase = LifecyclePhase.PROCESS_SOURCES, threadSafe = true ) -@SuppressWarnings({"PMD.ImmutableField", "PMD.AvoidDuplicateLiterals"}) public final class PlaceMojo extends SafeMojo { - - /** - * Output. - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter( - property = "eo.outputDir", - required = true, - defaultValue = "${project.build.outputDirectory}" - ) - private File outputDir; - - /** - * List of inclusion GLOB filters for finding class files. - * @since 0.15 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter - private Set includeBinaries = new SetOf<>("**"); - - /** - * List of exclusion GLOB filters for finding class files. - * @since 0.15 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter - private Set excludeBinaries = new SetOf<>(); - - /** - * Place only binaries that have EO sources inside jar. - * @since 0.31 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter - @SuppressWarnings("PMD.LongVariable") - private boolean placeBinariesThatHaveSources; - @Override public void exec() throws IOException { final Path home = this.targetDir.toPath().resolve(ResolveMojo.DIR); diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java index 9fc3e30e6e..19a988527a 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ProbeMojo.java @@ -32,7 +32,6 @@ import java.util.HashSet; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.cactoos.iterable.Filtered; import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; @@ -57,15 +56,6 @@ threadSafe = true ) public final class ProbeMojo extends SafeMojo { - /** - * The Git tag to pull objects from, in objectionary. - * - * @since 0.21.0 - */ - @SuppressWarnings("PMD.ImmutableField") - @Parameter(property = "eo.tag", required = true, defaultValue = "master") - private String tag = "master"; - /** * The Git hash to pull objects from, in objectionary. * If not set, will be computed from {@code tag} field. diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java index 0da6e81cc5..f0db3e962e 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/PullMojo.java @@ -32,7 +32,6 @@ import java.util.function.Supplier; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.cactoos.text.TextOf; import org.eolang.maven.footprint.CachePath; import org.eolang.maven.footprint.Footprint; @@ -69,14 +68,6 @@ public final class PullMojo extends SafeMojo { */ public static final String CACHE = "pulled"; - /** - * The Git tag to pull objects from, in objectionary. - * @since 0.21.0 - */ - @SuppressWarnings("PMD.ImmutableField") - @Parameter(property = "eo.tag", required = true, defaultValue = "master") - private String tag = "master"; - /** * The Git hash to pull objects from, in objectionary. * If not set, will be computed from {@code tag} field. @@ -97,14 +88,6 @@ public final class PullMojo extends SafeMojo { new OyRemote(this.hash) ); - /** - * Pull again even if the .eo file is already present? - * @since 0.10.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.overWrite", required = true, defaultValue = "false") - private boolean overWrite; - @Override public void exec() throws IOException { if (this.offline) { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/ResolveMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/ResolveMojo.java index 8de3206c87..cab3b82180 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/ResolveMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/ResolveMojo.java @@ -31,13 +31,11 @@ import java.util.Collection; import java.util.Comparator; import java.util.Optional; -import java.util.function.BiConsumer; import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.maven.model.Dependency; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.cactoos.Func; import org.cactoos.iterable.Mapped; import org.cactoos.list.ListOf; @@ -73,65 +71,6 @@ public final class ResolveMojo extends SafeMojo { */ public static final String DIR = "5-resolve"; - /** - * Skip artifact with the version 0.0.0. - * - * @since 0.9.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.skipZeroVersions", required = true, defaultValue = "true") - private boolean skipZeroVersions; - - /** - * Shall we discover JAR artifacts for .EO sources? - * - * @since 0.12.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.discoverSelf", required = true, defaultValue = "false") - private boolean discoverSelf; - - /** - * Fail resolution process on conflicting dependencies. - * - * @since 0.1.0 - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreVersionConflicts", required = true, defaultValue = "false") - @SuppressWarnings("PMD.LongVariable") - private boolean ignoreVersionConflicts; - - /** - * Fail resolution process on transitive dependencies. - * - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreTransitive", required = true, defaultValue = "false") - @SuppressWarnings("PMD.ImmutableField") - private boolean ignoreTransitive; - - /** - * Add eo-runtime dependency to the classpath. - * - *

That property is useful only for eo-runtime library compilation. - * When you compile eo-runtime, you don't want to add eo-runtime from foreign sources - * (since you compile an eo-runtime library and classpath will anyway have all required classes) - * and in this case, you should set this property to false. - * In any other cases, the eo-runtime - * dependency will be downloaded and added to the classpath automatically.

- * - * @checkstyle MemberNameCheck (7 lines) - */ - @Parameter(property = "eo.ignoreRuntime", required = true, defaultValue = "true") - @SuppressWarnings({"PMD.ImmutableField", "PMD.LongVariable"}) - private boolean withRuntimeDependency = true; - - /** - * The central. - */ - @SuppressWarnings("PMD.ImmutableField") - private BiConsumer central; - /** * Transitive dependency extractor. It's a strategy pattern for extracting transitive * dependencies for a particular artifact. @@ -152,9 +91,6 @@ public final class ResolveMojo extends SafeMojo { @Override public void exec() throws IOException { - if (this.central == null) { - this.central = new Central(this.project, this.session, this.manager); - } final Collection deps = this.deps(); final Path target = this.targetDir.toPath().resolve(ResolveMojo.DIR); for (final Dependency dep : deps) { diff --git a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java index b5260008e2..d52c5af217 100644 --- a/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java +++ b/eo-maven-plugin/src/main/java/org/eolang/maven/SafeMojo.java @@ -30,16 +30,20 @@ import java.io.Closeable; import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.function.BiConsumer; import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Dependency; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.BuildPluginManager; import org.apache.maven.plugin.MojoFailureException; @@ -48,6 +52,7 @@ import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.cactoos.scalar.Sticky; +import org.cactoos.set.SetOf; import org.eolang.maven.tojos.ForeignTojos; import org.eolang.maven.tojos.PlacedTojos; import org.eolang.maven.tojos.TranspiledTojos; @@ -138,6 +143,18 @@ abstract class SafeMojo extends AbstractMojo { ) protected File targetDir; + /** + * Output. + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (10 lines) + */ + @Parameter( + property = "eo.outputDir", + required = true, + defaultValue = "${project.build.outputDirectory}" + ) + protected File outputDir; + /** * Current scope (either "compile" or "test"). * @checkstyle VisibilityModifierCheck (5 lines) @@ -257,6 +274,111 @@ abstract class SafeMojo extends AbstractMojo { @Parameter(property = "eo.offline", required = true, defaultValue = "false") protected boolean offline; + /** + * The Git tag to pull objects from, in objectionary. + * @since 0.21.0 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @SuppressWarnings("PMD.ImmutableField") + @Parameter(property = "eo.tag", required = true, defaultValue = "master") + protected String tag = "master"; + + /** + * Pull again even if the .eo file is already present? + * @since 0.10.0 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter(property = "eo.overWrite", required = true, defaultValue = "false") + protected boolean overWrite; + + /** + * Skip artifact with the version 0.0.0. + * + * @since 0.9.0 + * @checkstyle MemberNameCheck (7 lines) + * @checkstyle VisibilityModifierCheck (5 lines) + */ + @Parameter(property = "eo.skipZeroVersions", required = true, defaultValue = "true") + protected boolean skipZeroVersions; + + /** + * Place only binaries that have EO sources inside jar. + * @since 0.31 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter + @SuppressWarnings("PMD.LongVariable") + protected boolean placeBinariesThatHaveSources; + + /** + * Fail resolution process on conflicting dependencies. + * + * @since 0.1.0 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter(property = "eo.ignoreVersionConflicts", required = true, defaultValue = "false") + @SuppressWarnings("PMD.LongVariable") + protected boolean ignoreVersionConflicts; + + /** + * Shall we discover JAR artifacts for .EO sources? + * + * @since 0.12.0 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter(property = "eo.discoverSelf", required = true, defaultValue = "false") + protected boolean discoverSelf; + + /** + * List of inclusion GLOB filters for finding class files. + * @since 0.15 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter + protected Set includeBinaries = new SetOf<>("**"); + + /** + * List of exclusion GLOB filters for finding class files. + * @since 0.15 + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter + protected Set excludeBinaries = new SetOf<>(); + + /** + * Add eo-runtime dependency to the classpath. + * + *

That property is useful only for eo-runtime library compilation. + * When you compile eo-runtime, you don't want to add eo-runtime from foreign sources + * (since you compile an eo-runtime library and classpath will anyway have all required classes) + * and in this case, you should set this property to false. + * In any other cases, the eo-runtime + * dependency will be downloaded and added to the classpath automatically.

+ * + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter(property = "eo.ignoreRuntime", required = true, defaultValue = "true") + @SuppressWarnings({"PMD.ImmutableField", "PMD.LongVariable"}) + protected boolean withRuntimeDependency = true; + + /** + * Fail resolution process on transitive dependencies. + * + * @checkstyle MemberNameCheck (10 lines) + * @checkstyle VisibilityModifierCheck (7 lines) + */ + @Parameter(property = "eo.ignoreTransitive", required = true, defaultValue = "false") + @SuppressWarnings("PMD.ImmutableField") + protected boolean ignoreTransitive; + /** * The current version of eo-maven-plugin. * Maven 3 only. @@ -286,6 +408,15 @@ abstract class SafeMojo extends AbstractMojo { new Sticky<>(() -> Catalogs.INSTANCE.make(this.transpiled.toPath(), this.transpiledFormat)) ); + /** + * The central. + * + * @checkstyle MemberNameCheck (7 lines) + * @checkstyle VisibilityModifierCheck (5 lines) + */ + @SuppressWarnings("PMD.ImmutableField") + protected BiConsumer central; + /** * Cached tojos. * @checkstyle VisibilityModifierCheck (5 lines) @@ -325,6 +456,9 @@ public final void execute() throws MojoFailureException { } } else { try { + if (this.central == null) { + this.central = new Central(this.project, this.session, this.manager); + } final long start = System.nanoTime(); this.execWithTimeout(); if (Logger.isDebugEnabled(this)) { diff --git a/eo-runtime/pom.xml b/eo-runtime/pom.xml index 08db2255b2..4357dfdebd 100644 --- a/eo-runtime/pom.xml +++ b/eo-runtime/pom.xml @@ -234,8 +234,8 @@ SOFTWARE. compile register - deps - assemble + compile + lint transpile xmir-to-phi phi-to-xmir @@ -258,9 +258,7 @@ SOFTWARE. generate-test-sources register - deps - assemble - lint + compile xmir-to-phi phi-to-xmir transpile diff --git a/eo-runtime/src/test/java/integration/PhiUnphiIT.java b/eo-runtime/src/test/java/integration/PhiUnphiIT.java new file mode 100644 index 0000000000..5390182321 --- /dev/null +++ b/eo-runtime/src/test/java/integration/PhiUnphiIT.java @@ -0,0 +1,213 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2016-2025 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 integration; + +import com.jcabi.manifests.Manifests; +import com.yegor256.MayBeSlow; +import com.yegor256.Mktmp; +import com.yegor256.MktmpResolver; +import com.yegor256.WeAreOnline; +import com.yegor256.farea.Farea; +import com.yegor256.farea.RequisiteMatcher; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * Integration test for phi-unphi. + * + * @since 0.1 + * @checkstyle MethodLengthCheck (500 lines) + */ +@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) +@ExtendWith(MktmpResolver.class) +final class PhiUnphiIT { + + @Test + @ExtendWith(MayBeSlow.class) + @ExtendWith(WeAreOnline.class) + void runsTestsAfterPhiAndUnphi(final @Mktmp Path temp) throws IOException { + new Farea(temp).together( + f -> { + f.files().file("src/main").save( + Paths.get(System.getProperty("user.dir")).resolve("src/main") + ); + f.files().file("src/test/eo").save( + Paths.get(System.getProperty("user.dir")).resolve("src/test/eo") + ); + f.properties() + .set("project.build.sourceEncoding", StandardCharsets.UTF_8.name()) + .set("project.reporting.outputEncoding", StandardCharsets.UTF_8.name()); + f.dependencies().append( + "net.sf.saxon", + "Saxon-HE", + "12.4" + ); + f.build() + .plugins() + .append( + "org.eolang", + "eo-maven-plugin", + System.getProperty( + "eo.version", + Manifests.read("EO-Version") + ) + ) + .execution("phi-unphi") + .phase("process-sources") + .goals( + "register", + "deps", + "parse", + "xmir-to-phi", + "phi-to-xmir", + "print" + ) + .configuration() + .set("sourcesDir", "${project.basedir}/src/test/eo") + .set("targetDir", "${project.build.directory}/eo-test") + .set("phiInputDir", "${project.build.directory}/eo-test/2-optimize") + .set("phiOutputDir", "${project.basedir}/src/phi") + .set("unphiInputDir", "${project.basedir}/src/phi") + .set("unphiOutputDir", "${project.build.directory}/generated-eo-test/1-parse") + .set("unphiMetas", new String[]{"+tests", "+unlint abstract-decoratee"}) + .set("printSourcesDir", "${project.build.directory}/generated-eo-test/1-parse") + .set("printOutputDir", "${project.basedir}/src/test/generated-eo") + .set("printReversed", Boolean.TRUE.toString()); + f.exec("clean", "compile"); + MatcherAssert.assertThat( + "Converting to phi and back was not successful", + f.log(), + RequisiteMatcher.SUCCESS + ); + f.files().file("pom.xml").delete(); + f.properties() + .set("project.build.sourceEncoding", StandardCharsets.UTF_8.name()) + .set("project.reporting.outputEncoding", StandardCharsets.UTF_8.name()); + f.dependencies().append( + "org.junit.jupiter", + "junit-jupiter-engine", + "5.10.3" + ); + f.dependencies().append( + "org.junit.jupiter", + "junit-jupiter-params", + "5.10.3" + ); + f.dependencies().append( + "org.junit.jupiter", + "junit-jupiter-api", + "5.10.3" + ); + f.dependencies().append( + "org.junit-pioneer", + "junit-pioneer", + "2.2.0" + ); + f.build() + .plugins() + .append( + "org.eolang", + "eo-maven-plugin", + System.getProperty( + "eo.version", + Manifests.read("EO-Version") + ) + ) + .execution("compile") + .goals( + "register", + "assemble", + "lint", + "transpile", + "copy", + "unplace", + "unspile" + ) + .configuration() + .set("foreign", "${project.basedir}/target/eo-foreign.csv") + .set("foreignFormat", "csv") + .set("failOnWarning", Boolean.FALSE.toString()) + .set("offline", Boolean.TRUE.toString()) + .set("withRuntimeDependency", Boolean.FALSE.toString()) + .set("placeBinariesThatHaveSources", Boolean.TRUE.toString()); + f.build() + .plugins() + .append( + "org.eolang", + "eo-maven-plugin", + System.getProperty( + "eo.version", + "1.0-SNAPSHOT" + ) + ) + .execution("deps") + .phase("process-sources") + .goals("deps"); + f.build() + .plugins() + .append( + "org.eolang", + "eo-maven-plugin", + System.getProperty( + "eo.version", + "1.0-SNAPSHOT" + ) + ) + .execution("tests") + .phase("generate-test-sources") + .goals( + "register", + "assemble", + "lint", + "transpile" + ) + .configuration() + .set("foreign", "${project.basedir}/target/eo-foreign.csv") + .set("foreignFormat", "csv") + .set("failOnWarning", Boolean.FALSE.toString()) + .set("offline", Boolean.TRUE.toString()) + .set("scope", "test") + .set("sourcesDir", "${project.basedir}/src/test/generated-eo") + .set("targetDir", "${project.basedir}/target/eo-test") + .set("addSourcesRoot", Boolean.FALSE.toString()) + .set("addTestSourcesRoot", Boolean.TRUE.toString()) + .set("failOnWarning", Boolean.FALSE.toString()) + .set("generatedDir", "${project.basedir}/target/generated-test-sources") + .set("withRuntimeDependency", Boolean.FALSE.toString()) + .set("placeBinariesThatHaveSources", Boolean.TRUE.toString()); + f.exec("clean", "test"); + MatcherAssert.assertThat( + "Some tests weren't passed after converting to phi and back", + f.log(), + RequisiteMatcher.SUCCESS + ); + } + ); + } +} From 63f8910481cc5e3ec0cd4f2b48e105f74d05a15b Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 6 Feb 2025 13:56:26 +0300 Subject: [PATCH 22/23] #3797: polished --- eo-runtime/src/test/eo/org/eolang/bytes-tests.eo | 4 ++-- .../src/test/eo/org/eolang/fs/dir-tests.eo | 2 +- .../src/test/eo/org/eolang/fs/file-tests.eo | 12 ++++++------ .../eo/org/eolang/io/malloc-as-output-test.eo | 2 +- .../src/test/eo/org/eolang/malloc-tests.eo | 14 +++++++------- .../src/test/eo/org/eolang/math/real-tests.eo | 2 +- .../src/test/eo/org/eolang/runtime-tests.eo | 2 +- .../src/test/eo/org/eolang/string-tests.eo | 8 ++++---- .../eo/org/eolang/structs/range-of-ints-tests.eo | 6 +++--- .../src/test/eo/org/eolang/switch-tests.eo | 2 +- eo-runtime/src/test/eo/org/eolang/tuple-tests.eo | 4 ++-- .../src/test/eo/org/eolang/txt/regex-tests.eo | 16 ++++++++-------- .../src/test/eo/org/eolang/txt/sprintf-tests.eo | 4 ++-- .../src/test/eo/org/eolang/txt/sscanf-tests.eo | 2 +- .../src/test/eo/org/eolang/txt/text-tests.eo | 6 +++--- .../src/test/groovy/check-target-files.groovy | 2 +- 16 files changed, 44 insertions(+), 44 deletions(-) diff --git a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo index 8a24da6efc..e117979ef5 100644 --- a/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/bytes-tests.eo @@ -423,11 +423,11 @@ not. > tests-left-with-odd-neg FF-FF-FF-FF-00-00-00-01 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-bytes-of-wrong-size-as-number +[] > throws-on-bytes-of-wrong-size-as-number 01-01-01-01.as-number > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-bytes-of-wrong-size-as-i64 +[] > throws-on-bytes-of-wrong-size-as-i64 01-01-01-01.as-i64 > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo index 6237955163..84f49ef6d6 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/dir-tests.eo @@ -58,7 +58,7 @@ .not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-opening-directory +[] > throws-on-opening-directory tmpdir.open > @ "w" true > [d] diff --git a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo index 1808931c1b..35efd1f788 100644 --- a/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/fs/file-tests.eo @@ -74,7 +74,7 @@ tmpdir.tmpfile.deleted.deleted.exists.not > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-an-error-on-touching-temp-file-in-absent-dir +[] > throws-an-error-on-touching-temp-file-in-absent-dir (tmpdir.as-path.resolved "foo").as-dir.tmpfile > @ # This unit test is supposed to check the functionality of the corresponding object. @@ -103,7 +103,7 @@ temp.exists.not # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-opening-with-wrong-mode +[] > throws-on-opening-with-wrong-mode tmpdir .tmpfile .open > @ @@ -111,7 +111,7 @@ f > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-reading-from-not-existed-file +[] > throws-on-reading-from-not-existed-file tmpdir .tmpfile .deleted @@ -120,7 +120,7 @@ f > [f] # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-reading-or-writing-from-not-existed-file +[] > throws-on-reading-or-writing-from-not-existed-file tmpdir .tmpfile .deleted @@ -257,7 +257,7 @@ .eq 12 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-writing-with-wrong-mode +[] > throws-on-writing-with-wrong-mode tmpdir .tmpfile .open > @ @@ -286,7 +286,7 @@ .eq "Hello, world" > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-reading-from-file-with-wrong-mode +[] > throws-on-reading-from-file-with-wrong-mode tmpdir .tmpfile .open > @ diff --git a/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo b/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo index a7717005be..40d71f9a61 100644 --- a/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo +++ b/eo-runtime/src/test/eo/org/eolang/io/malloc-as-output-test.eo @@ -45,7 +45,7 @@ 01-02-03-04-05-06-07-08-09-A0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-writing-more-than-allocated +[] > throws-on-writing-more-than-allocated malloc.of > @ 2 [m] diff --git a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo index 1d5a2f395e..d068ac6a9b 100644 --- a/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/malloc-tests.eo @@ -115,13 +115,13 @@ b.eq 20 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-overflow-boolean-malloc +[] > throws-on-overflow-boolean-malloc malloc.for > @ false m.put 86124867.88 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-overflow-string-malloc +[] > throws-on-overflow-string-malloc malloc.for > @ "Hello" m.put "Much longer string!" > [m] @@ -204,7 +204,7 @@ (m.read 0 3).eq "XYX" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-writing-more-than-allocated-to-malloc-with-offset +[] > throws-on-writing-more-than-allocated-to-malloc-with-offset malloc.of > @ 1 m.write 1 true > [m] @@ -258,7 +258,7 @@ m.get.eq 01-02-03 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-changing-size-to-negative +[] > throws-on-changing-size-to-negative malloc.of > @ 1 m.resized -1 > [m] @@ -287,19 +287,19 @@ m.get.eq 01-02-03-01-02-03 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-copying-with-wrong-source +[] > throws-on-copying-with-wrong-source malloc.for > @ 0 m.copy 9 1 1 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-copying-with-wrong-target +[] > throws-on-copying-with-wrong-target malloc.for > @ 0 m.copy 3 9 1 > [m] # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-copying-with-wrong-length +[] > throws-on-copying-with-wrong-length malloc.for > @ 0 m.copy 3 1 9 > [m] diff --git a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo index 2eb205d46d..7422cd16d6 100644 --- a/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/math/real-tests.eo @@ -152,7 +152,7 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-negative-pow-of-zero +[] > throws-on-negative-pow-of-zero (real 0).pow -567 > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo index b0b657942b..f6cace9dc4 100644 --- a/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/runtime-tests.eo @@ -73,7 +73,7 @@ true > global-test 42 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-when-applies-to-closed-object +[] > throws-when-applies-to-closed-object [x] > a x > @ a false > closed diff --git a/eo-runtime/src/test/eo/org/eolang/string-tests.eo b/eo-runtime/src/test/eo/org/eolang/string-tests.eo index 9b97ef1355..ee9e3a0092 100644 --- a/eo-runtime/src/test/eo/org/eolang/string-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/string-tests.eo @@ -75,7 +75,7 @@ # This unit test is supposed to check the functionality of the corresponding object. # The smile emoji is F0-9F-98-80 in bytes. Here we check if string.length fails if it faces # incomplete 4 byte character. -[] > tests-throws-on-taking-length-of-incomplete-n4-byte-character +[] > throws-on-taking-length-of-incomplete-n4-byte-character string F0-9F-98 > should-be-smile should-be-smile.length > @ @@ -264,21 +264,21 @@ "大" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-slicing-start-below-zero +[] > throws-on-slicing-start-below-zero slice. > @ "some string" -1 1 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-slicing-end-below-start +[] > throws-on-slicing-end-below-start slice. > @ "some string" 2 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-slicing-end-greater-actual +[] > throws-on-slicing-end-greater-actual slice. > @ "some string" 7 diff --git a/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo b/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo index 19e78889dd..c0a3f30239 100644 --- a/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/structs/range-of-ints-tests.eo @@ -52,13 +52,13 @@ * -5 -4 -3 -2 -1 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-range-of-ints-with-non-int-start +[] > throws-on-range-of-ints-with-non-int-start range-of-ints 1.2 3 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-range-of-ints-with-not-int-end +[] > throws-on-range-of-ints-with-not-int-end range-of-ints 1 2.5 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-range-of-not-ints +[] > throws-on-range-of-not-ints range-of-ints 1.5 5.2 > @ diff --git a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo index 0996413997..123869c737 100644 --- a/eo-runtime/src/test/eo/org/eolang/switch-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/switch-tests.eo @@ -86,7 +86,7 @@ "false2" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-empty-switch +[] > throws-on-empty-switch switch * > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo index 5fe9e88450..9a74532fe4 100644 --- a/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/tuple-tests.eo @@ -106,7 +106,7 @@ "with" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-wrong-tuple-at +[] > throws-on-wrong-tuple-at at. > @ * 1 2 3 4 20 @@ -212,6 +212,6 @@ 0 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-out-of-tuple-bounds-with-negative-index +[] > throws-on-out-of-tuple-bounds-with-negative-index * 0 1 2 3 4 > arr arr.at -6 > @ diff --git a/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo index df291af2bd..2f9c57b4dd 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/regex-tests.eo @@ -64,31 +64,31 @@ second.to.eq 12 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-next-on-not-matched-block +[] > throws-on-getting-next-on-not-matched-block ((regex "/[a-z]+/").match "123").next.next > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-from-position-on-not-matched-block +[] > throws-on-getting-from-position-on-not-matched-block ((regex "/[a-z]+/").match "123").next.from > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-to-position-on-not-matched-block +[] > throws-on-getting-to-position-on-not-matched-block ((regex "/[a-z]+/").match "123").next.to > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-groups-count-on-not-matched-block +[] > throws-on-getting-groups-count-on-not-matched-block ((regex "/[a-z]+/").match "123").next.groups-count > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-groups-on-not-matched-block +[] > throws-on-getting-groups-on-not-matched-block ((regex "/[a-z]+/").match "123").next.groups > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-specified-group-on-not-matched-block +[] > throws-on-getting-specified-group-on-not-matched-block ((regex "/[a-z]+/").match "123").next.group 1 > @ # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-getting-text-on-not-matched-block +[] > throws-on-getting-text-on-not-matched-block ((regex "/[a-z]+/").match "123").next.text > @ # This unit test is supposed to check the functionality of the corresponding object. @@ -156,7 +156,7 @@ "Yıldırım" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-missing-first-slash-in-regex +[] > throws-on-missing-first-slash-in-regex (regex "(.)+").compiled > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo index e91d4cdaba..645c051553 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/sprintf-tests.eo @@ -62,7 +62,7 @@ * "Jeff" "Jeff".as-bytes 42.3 14 false # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-sprintf-with-arguments-that-does-not-match +[] > throws-on-sprintf-with-arguments-that-does-not-match sprintf > @ "%s%s" * "Jeff" @@ -76,7 +76,7 @@ * "Hey" "Jeff" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-sprintf-unsupported-format +[] > throws-on-sprintf-unsupported-format sprintf "%o" * > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo index 827e7271a4..579f4c0927 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/sscanf-tests.eo @@ -54,7 +54,7 @@ sscanf "%f" "0.24" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-sscanf-with-wrong-format +[] > throws-on-sscanf-with-wrong-format sscanf "%l" "error" > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo b/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo index aa50c1ea1a..930422a44c 100644 --- a/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo +++ b/eo-runtime/src/test/eo/org/eolang/txt/text-tests.eo @@ -140,7 +140,7 @@ (text "some").at -2 # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-text-at-index-more-than-length +[] > throws-on-text-at-index-more-than-length (text "some").at 10 > @ # This unit test is supposed to check the functionality of the corresponding object. @@ -183,7 +183,7 @@ * "hello" "world" "dear" "friend" # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-text-repeating-less-than-zero-times +[] > throws-on-text-repeating-less-than-zero-times (text "").repeated -1 > @ # This unit test is supposed to check the functionality of the corresponding object. @@ -357,7 +357,7 @@ (text "5").as-number # This unit test is supposed to check the functionality of the corresponding object. -[] > tests-throws-on-converting-text-to-number +[] > throws-on-converting-text-to-number (text "Hello").as-number > @ # This unit test is supposed to check the functionality of the corresponding object. diff --git a/eo-runtime/src/test/groovy/check-target-files.groovy b/eo-runtime/src/test/groovy/check-target-files.groovy index 0b8821322d..6d8afeab92 100644 --- a/eo-runtime/src/test/groovy/check-target-files.groovy +++ b/eo-runtime/src/test/groovy/check-target-files.groovy @@ -39,7 +39,7 @@ List expected = [ 'eo-test/unphi/org/eolang/number-tests.xmir', 'generated-sources/EOorg/EOeolang/EOdataized.java', 'generated-sources/EOorg/EOeolang/EOnet/EOsocket.java', - 'generated-test-sources/EOorg/EOeolang/EOand_with_zeroTest.java', + 'generated-test-sources/EOorg/EOeolang/EOtests_and_with_zeroTest.java', 'classes/EO-SOURCES/org/eolang/false.eo', ] From 7b455413ede0dc0e390e5e40407eeb3b9f836456 Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Thu, 6 Feb 2025 15:12:38 +0300 Subject: [PATCH 23/23] #3797: no skip --- .github/workflows/qulice.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/qulice.yml b/.github/workflows/qulice.yml index 8499057d24..bc3ddc1cc0 100644 --- a/.github/workflows/qulice.yml +++ b/.github/workflows/qulice.yml @@ -43,4 +43,4 @@ jobs: path: ~/.m2/repository key: ubuntu-qulice-jdk-21-maven-${{ hashFiles('**/pom.xml') }} restore-keys: ubuntu-qulice-jdk-21-maven- - - run: mvn clean verify -PskipTests -Deo.skip -Pqulice --errors --batch-mode + - run: mvn clean verify -PskipTests -Pqulice --errors --batch-mode