-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
eo-maven-plugin/src/test/java/org/eolang/maven/ParseMojoIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package org.eolang.maven; | ||
|
||
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 java.nio.file.Path; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Integration tests for {@link ParseMojo}. | ||
* | ||
* @since 0.52 | ||
*/ | ||
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) | ||
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class}) | ||
final class ParseMojoIT { | ||
@Test | ||
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() | ||
); | ||
f.build() | ||
.plugins() | ||
.append( | ||
"org.eolang", | ||
"eo-maven-plugin", | ||
System.getProperty( | ||
"eo.version", | ||
Manifests.read("EO-Version") | ||
) | ||
) | ||
.execution() | ||
.goals("register", "parse"); | ||
f.exec("compile", String.format("-Deo.cache=%s", temp.resolve("cache"))); | ||
MatcherAssert.assertThat( | ||
"the XMIR file is generated", | ||
f.files().file( | ||
String.format("target/eo/%s/foo.xmir", ParseMojo.DIR) | ||
).exists(), | ||
Matchers.is(true) | ||
); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
eo-maven-plugin/src/test/java/org/eolang/maven/PrintMojoIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package org.eolang.maven; | ||
|
||
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 java.nio.file.Path; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Integration tests for {@link PrintMojo}. | ||
* | ||
* @since 0.52 | ||
*/ | ||
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) | ||
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class}) | ||
final class PrintMojoIT { | ||
@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( | ||
String.join( | ||
" ", | ||
"# This unit test is supposed to check", | ||
"the functionality of the corresponding object.\n[] > foo\n" | ||
).getBytes() | ||
); | ||
f.build() | ||
.plugins() | ||
.append( | ||
"org.eolang", | ||
"eo-maven-plugin", | ||
System.getProperty( | ||
"eo.version", | ||
Manifests.read("EO-Version") | ||
) | ||
) | ||
.execution() | ||
.goals("register", "parse"); | ||
f.exec("compile"); | ||
f.files() | ||
.file("src/main/xmir/foo.xmir") | ||
.save( | ||
f.files() | ||
.file( | ||
String.format("target/eo/%s/foo.xmir", ParseMojo.DIR) | ||
).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) | ||
); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters