Skip to content

Commit

Permalink
#3492 more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 14, 2024
1 parent ce7353b commit b29a9eb
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.jcabi.xml.XMLDocument;
import com.yegor256.Mktmp;
import com.yegor256.MktmpResolver;
import com.yegor256.farea.Farea;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -60,6 +61,30 @@
@ExtendWith(MktmpResolver.class)
final class OptimizeMojoTest {

@Test
void optimizesSimpleObject(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
f.clean();
f.files().file("src/main/eo/foo.eo").write(
"Test.\n[] > foo\n".getBytes()
);
f.build()
.plugins()
.appendItself()
.execution()
.goals("register", "parse", "optimize");
f.exec("compile");
MatcherAssert.assertThat(
"the .xmir file is generated",
f.files().file("target/eo/2-optimize/foo.xmir").exists(),
Matchers.is(true)
);
f.files().show();
}
);
}

@ParameterizedTest
@ClasspathSource(value = "org/eolang/maven/packs/", glob = "**.yaml")
void checksPacks(final String pack) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
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;
Expand All @@ -57,7 +56,6 @@ final class PhiMojoTest {
"# This is the default 64+ symbols comment in front of named abstract object.";

@Test
@Disabled
void convertsSimpleObjectToPhi(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
Expand Down
29 changes: 29 additions & 0 deletions eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import com.yegor256.Mktmp;
import com.yegor256.MktmpResolver;
import com.yegor256.farea.Farea;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -52,6 +53,34 @@
*/
@ExtendWith(MktmpResolver.class)
final class PrintMojoTest {
@Test
void printsSimpleObject(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
f.clean();
f.files().file("src/main/eo/foo.eo").write(
"# Test.\n[] > foo\n".getBytes()
);
f.build()
.plugins()
.appendItself()
.execution()
.goals("register", "parse");
f.exec("compile");
f.files()
.file("src/main/xmir/foo.xmir")
.save(f.files().file("target/eo/1-parse/foo.xmir").path());
f.exec("eo:print");
MatcherAssert.assertThat(
"the .phi file is generated",
f.files().file("target/generated-sources/eo/foo.eo").exists(),
Matchers.is(true)
);
f.files().show();
}
);
}

@Test
void printsSuccessfully(@Mktmp final Path temp) throws Exception {
final Home home = new HmBase(temp);
Expand Down
31 changes: 31 additions & 0 deletions eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import com.jcabi.log.Logger;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import com.yegor256.Mktmp;
import com.yegor256.MktmpResolver;
import com.yegor256.farea.Farea;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand All @@ -47,6 +50,7 @@
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;
import org.junit.jupiter.api.function.Executable;
import org.junit.jupiter.params.ParameterizedTest;
import org.yaml.snakeyaml.Yaml;
Expand All @@ -57,7 +61,34 @@
* @since 0.1
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
@ExtendWith(MktmpResolver.class)
final class SodgMojoTest {

@Test
void convertsSimpleObjectToGraph(@Mktmp final Path temp) throws Exception {
new Farea(temp).together(
f -> {
f.clean();
f.files().file("src/main/eo/foo.eo").write(
"# Test.\n[] > foo\n".getBytes()
);
f.build()
.plugins()
.appendItself()
.execution()
.goals("register", "parse", "optimize", "shake", "sodg");
f.exec("compile");
f.files().show();
MatcherAssert.assertThat(
"the .sodg file is generated",
f.files().file("target/eo/sodg/foo.sodg").exists(),
Matchers.is(true)
);
f.files().show();
}
);
}

@Test
@Disabled
void convertsToGraph() throws Exception {
Expand Down

0 comments on commit b29a9eb

Please sign in to comment.