Skip to content

Commit

Permalink
fix(#2405): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Aug 18, 2023
1 parent 4361c7e commit b1fd075
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@ final class AssembleMojoTest {
@Test
void assemblesTogether(@TempDir final Path temp) throws IOException {
final Map<String, Path> result = new FakeMaven(temp)
.withProgram(
"+alias stdout org.eolang.io.stdout",
"",
"[x] > main",
" (stdout \"Hello!\" x).print"
)
.withHelloWorld()
.execute(AssembleMojo.class)
.result();
final String parsed = String.format(
Expand Down
36 changes: 6 additions & 30 deletions eo-maven-plugin/src/test/java/org/eolang/maven/CleanMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.cactoos.set.SetOf;
import org.eolang.maven.objectionary.Objectionaries;
import org.eolang.maven.util.Home;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -64,41 +61,20 @@ void cleansSuccessfully(@TempDir final Path temp) throws IOException {
@Test
@ExtendWith(OnlineCondition.class)
void makesFullCompilingLifecycleSuccessfully(@TempDir final Path temp) throws IOException {
final Path src = temp.resolve("src");
new Home(src).save(
String.join(
"\n",
"+alias stdout org.eolang.io.stdout",
"",
"[x] > main\n (stdout \"Hello!\" x).print\n"
),
Paths.get("main.eo")
);
final Path target = temp.resolve("target");
new Moja<>(RegisterMojo.class)
.with("foreign", temp.resolve("eo-foreign.json").toFile())
.with("foreignFormat", "json")
.with("sourcesDir", src.toFile())
new FakeMaven(temp)
.withHelloWorld()
.with("includeSources", new SetOf<>("**.eo"))
.execute();
new Moja<>(AssembleMojo.class)
.with("outputDir", temp.resolve("out").toFile())
.with("targetDir", target.toFile())
.with("foreign", temp.resolve("eo-foreign.json").toFile())
.with("foreignFormat", "json")
.with("placed", temp.resolve("list").toFile())
.with("cache", temp.resolve("cache/parsed"))
.with("skipZeroVersions", true)
.with("central", Central.EMPTY)
.with("ignoreTransitive", true)
.with("plugin", FakeMaven.pluginDescriptor())
.with("objectionaries", new Objectionaries.Fake())
.execute();
new Moja<>(CleanMojo.class)
.with("targetDir", target.toFile())
.execute();
.execute(RegisterMojo.class)
.execute(AssembleMojo.class)
.execute(CleanMojo.class);
MatcherAssert.assertThat(
target.toFile().exists(),
temp.resolve("target").toFile().exists(),
Matchers.is(false)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,12 @@ FakeMaven withPlacedBinary(final Path binary) {
* @throws IOException If method can't save eo program to the workspace.
*/
FakeMaven withHelloWorld() throws IOException {
return this.withProgram("+package f\n", "[args] > main", " (stdout \"Hello!\").print");
return this.withProgram(
"+alias stdout org.eolang.io.stdout",
"+package f\n",
"[x] > main",
" (stdout \"Hello!\" x).print > @"
);
}

/**
Expand Down

0 comments on commit b1fd075

Please sign in to comment.