forked from objectionary/eo
-
Notifications
You must be signed in to change notification settings - Fork 0
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
130 additions
and
59 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
62 changes: 62 additions & 0 deletions
62
eo-maven-plugin/src/test/java/org/eolang/maven/ShakeMojoIT.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,62 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
package org.eolang.maven; | ||
|
||
import com.jcabi.manifests.Manifests; | ||
import com.jcabi.matchers.XhtmlMatchers; | ||
import com.jcabi.xml.XMLDocument; | ||
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.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* Integration tests for {@link ShakeMojo}. | ||
* | ||
* @since 0.52 | ||
*/ | ||
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) | ||
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class}) | ||
final class ShakeMojoIT { | ||
|
||
@Test | ||
void shakesSimpleObject(@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", "shake"); | ||
f.exec("compile"); | ||
} | ||
); | ||
MatcherAssert.assertThat( | ||
"the .xmir file contains lint defects", | ||
new XMLDocument(temp.resolve(String.format("target/eo/%s/foo.xmir", ShakeMojo.DIR))), | ||
XhtmlMatchers.hasXPaths("/program[not(errors)]") | ||
); | ||
} | ||
} |
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
66 changes: 66 additions & 0 deletions
66
eo-maven-plugin/src/test/java/org/eolang/maven/SodgMojoIT.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,66 @@ | ||
/* | ||
* 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 java.nio.file.Paths; | ||
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 SodgMojo}. | ||
* | ||
* @since 0.52 | ||
*/ | ||
@SuppressWarnings({"JTCOP.RuleAllTestsHaveProductionClass", "JTCOP.RuleNotContainsTestWord"}) | ||
@ExtendWith({WeAreOnline.class, MktmpResolver.class, MayBeSlow.class}) | ||
final class SodgMojoIT { | ||
@Test | ||
void convertsSimpleObjectToGraph(@Mktmp final Path temp) throws Exception { | ||
new Farea(temp).together( | ||
f -> { | ||
f.clean(); | ||
f.files().file("XMIR.xsd").save( | ||
Paths.get(System.getProperty("user.dir")).resolve( | ||
"../eo-parser/src/main/resources/XMIR.xsd" | ||
) | ||
); | ||
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", "shake", "sodg"); | ||
f.exec("compile"); | ||
MatcherAssert.assertThat( | ||
"the .sodg file is generated", | ||
f.files().file("target/eo/sodg/foo.sodg").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