Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions eo-integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@
<version>12.1.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<version>12.1.6</version>
<artifactId>jetty-http</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
79 changes: 44 additions & 35 deletions eo-integration-tests/src/test/java/integration/JarIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ final class JarIT {
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void runsProgramFromJar(final @Mktmp Path temp) throws IOException {
new Farea(temp).together(
f -> {
final String classpath = JarIT.compile(
f,
"# No comments.",
"[] > simple",
" QQ.io.stdout > @",
" \"Hello, world!\""
);
MatcherAssert.assertThat(
"simple program must be successfully executed",
new Jaxec(
"java", "-cp", classpath,
"java", "-cp", JarIT.compile(
f,
"# No comments.",
"[] > simple",
" QQ.io.stdout > @",
" \"Hello, world!\""
),
"-Dfile.encoding=UTF-8", "-Xss64M", "-Xms64M",
"org.eolang.Main", "simple"
).withHome(temp.resolve("target")).exec().stdout(),
Expand All @@ -59,22 +59,22 @@ void runsProgramFromJar(final @Mktmp Path temp) throws IOException {
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void runsProgramWithPackageFromJar(final @Mktmp Path temp) throws IOException {
new Farea(temp).together(
f -> {
final String classpath = JarIT.compile(
f,
"+package org.eolang.examples",
"",
"# Program with a package.",
"[args] > packaged",
" QQ.io.stdout > @",
" \"Hello, world from a program with a package!\""
);
MatcherAssert.assertThat(
"'packaged' program must be successfully executed",
new Jaxec(
"java", "-cp", classpath,
"java", "-cp", JarIT.compile(
f,
"+package org.eolang.examples",
"",
"# Program with a package.",
"[args] > packaged",
" QQ.io.stdout > @",
" \"Hello, world from a program with a package!\""
),
"-Dfile.encoding=UTF-8", "-Xss64M", "-Xms64M",
"org.eolang.Main", "org.eolang.examples.packaged"
).withHome(temp.resolve("target")).exec().stdout(),
Expand All @@ -87,6 +87,11 @@ void runsProgramWithPackageFromJar(final @Mktmp Path temp) throws IOException {
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@SuppressWarnings({
"PMD.UnitTestShouldIncludeAssert",
"PMD.UnnecessaryLocalRule",
"PMD.UnnecessaryVarargsArrayCreation"
})
void runsProgramWithTwoObjects(final @Mktmp Path temp) throws IOException {
new Farea(temp).together(
f -> {
Expand Down Expand Up @@ -162,20 +167,20 @@ void runsProgramWithTwoObjects(final @Mktmp Path temp) throws IOException {
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void printsErrorToStderr(final @Mktmp Path temp) throws IOException {
new Farea(temp).together(
f -> {
final String classpath = JarIT.compile(
f,
"# No comments.",
"[] > simple",
" unknown.io.stdout > @",
" \"Hello, world!\""
);
MatcherAssert.assertThat(
"the program must throw an error and print it to stderr",
new Jaxec(
"java", "-cp", classpath,
"java", "-cp", JarIT.compile(
f,
"# No comments.",
"[] > simple",
" unknown.io.stdout > @",
" \"Hello, world!\""
),
"-Dfile.encoding=UTF-8", "-Xss64M", "-Xms64M",
"org.eolang.Main", "simple"
).withHome(temp.resolve("target")).withCheck(false).execUnsafe().stderr(),
Expand Down Expand Up @@ -240,18 +245,22 @@ private static String compile(
farea.log(),
RequisiteMatcher.SUCCESS
);
final String ver = System.getProperty("eo.version", Manifests.read("EO-Version"));
final String jar = String.format("eo-runtime-%s.jar", ver);
final String runtime = Paths.get(System.getProperty("user.home")).resolve(".m2")
.resolve("repository")
.resolve("org/eolang/eo-runtime")
.resolve(ver)
.resolve(jar)
.toString();
return String.join(
File.pathSeparator,
"test-0.0.0.jar",
runtime
Paths.get(System.getProperty("user.home")).resolve(".m2")
.resolve("repository")
.resolve("org/eolang/eo-runtime")
.resolve(
System.getProperty("eo.version", Manifests.read("EO-Version"))
)
.resolve(
String.format(
"eo-runtime-%s.jar",
System.getProperty("eo.version", Manifests.read("EO-Version"))
)
)
.toString()
Comment on lines +251 to +263

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compile() now recomputes the EO runtime version via System.getProperty("eo.version", Manifests.read("EO-Version")) multiple times when building the runtime JAR path. Storing the resolved version in a local variable once would improve readability and avoid repeated manifest reads/property lookups, ensuring the same version is used consistently throughout the path construction.

Copilot uses AI. Check for mistakes.
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class ReadmeSnippetsIT {
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@MethodSource("snippets")
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void validatesReadmeSnippets(final String snippet, @Mktmp final Path temp) throws IOException {
new Farea(temp).together(
f -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class SnippetIT {
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@ClasspathSource(value = "org/eolang/snippets/", glob = "**.yaml")
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "PMD.UnitTestShouldIncludeAssert"})
void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOException {
final Xtory xtory = new XtSticky(new XtYaml(yml));
Assumptions.assumeFalse(xtory.map().containsKey("skip"));
Expand Down
1 change: 1 addition & 0 deletions eo-integration-tests/src/test/java/integration/XmirIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class XmirIT {
@Test
@ExtendWith(WeAreOnline.class)
@ExtendWith(MayBeSlow.class)
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void validatesWithXsd() throws IOException {
Files.walk(
Paths.get("").toAbsolutePath().getParent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
final class MjAssembleIT {

@Test
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void assemblesTogether(@Mktmp final Path temp) throws IOException {
final String stdout = "target/eo/%s/org/eolang/io/stdout.%s";
final String parsed = String.format(stdout, "1-parse", "xmir");
Expand Down Expand Up @@ -62,6 +63,7 @@ void assemblesTogether(@Mktmp final Path temp) throws IOException {
}

@Test
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void assemblesNotFailWithFailOnError(@Mktmp final Path temp) throws IOException {
final String prog = String.join(
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.yegor256.farea.Execution;
import com.yegor256.farea.Farea;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand Down Expand Up @@ -40,6 +41,7 @@
final class MjLintIT {

@Test
@SuppressWarnings({"PMD.UnitTestShouldIncludeAssert", "PMD.UnnecessaryLocalRule"})
void lintsAgainAfterModification(@Mktmp final Path temp)
throws Exception {
final String source = "src/main/eo/foo.eo";
Expand All @@ -48,7 +50,7 @@ void lintsAgainAfterModification(@Mktmp final Path temp)
new Farea(temp).together(
f -> {
f.clean();
f.files().file(source).write(program.getBytes());
f.files().file(source).write(program.getBytes(StandardCharsets.UTF_8));
MjLintIT.appendItself(f)
.configuration()
.set("failOnWarning", "false");
Expand All @@ -58,7 +60,7 @@ void lintsAgainAfterModification(@Mktmp final Path temp)
.path()
.toFile()
.lastModified();
f.files().file(source).write(program.getBytes());
f.files().file(source).write(program.getBytes(StandardCharsets.UTF_8));
f.exec("process-classes");
MatcherAssert.assertThat(
"the .xmir file is re-generated",
Expand All @@ -70,13 +72,16 @@ void lintsAgainAfterModification(@Mktmp final Path temp)
}

@Test
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void printsLintsUrlWithVersion(@Mktmp final Path temp)
throws IOException {
final String program = MjLintIT.helloWorld();
new Farea(temp).together(
f -> {
f.clean();
f.files().file("src/main/eo/foo.eo").write(program.getBytes());
f.files()
.file("src/main/eo/foo.eo")
.write(program.getBytes(StandardCharsets.UTF_8));
MjLintIT.appendItself(f)
.configuration()
.set("failOnWarning", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.yegor256.MktmpResolver;
import com.yegor256.WeAreOnline;
import com.yegor256.farea.Farea;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand All @@ -24,12 +25,13 @@
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class})
final class MjParseIT {
@Test
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void parsesSimpleFile(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
f.clean();
f.files().file("src/main/eo/foo.eo").write(
"# Simple object.\n[] > foo\n".getBytes()
"# Simple object.\n[] > foo\n".getBytes(StandardCharsets.UTF_8)
);
new AppendedPlugin(f).value()
.goals("register", "parse");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.yegor256.MktmpResolver;
import com.yegor256.WeAreOnline;
import com.yegor256.farea.Farea;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
Expand All @@ -24,6 +25,7 @@
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class})
final class MjPrintIT {
@Test
@SuppressWarnings("PMD.UnitTestShouldIncludeAssert")
void printsSimpleObject(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
Expand All @@ -33,7 +35,7 @@ void printsSimpleObject(@Mktmp final Path temp) throws Exception {
" ",
"# This unit test is supposed to check",
"the functionality of the corresponding object.\n[] > foo\n"
).getBytes()
).getBytes(StandardCharsets.UTF_8)
);
new AppendedPlugin(f).value()
.goals("register", "parse");
Expand Down
Loading
Loading