Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Aug 23, 2023
2 parents 53412e7 + b1fd075 commit 2a42bd2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,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 stdout = "target/%s/org/eolang/io/stdout.%s";
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ SOFTWARE.
</xsl:copy>
</xsl:template>
<xsl:template match="o" mode="abstract">
<xsl:variable name="attr" select="o[not(@name) and not(starts-with(@base, '.'))]"/>
<xsl:if test="$attr">
<xsl:for-each select="o[not(@name)]">
<xsl:element name="error">
<xsl:attribute name="check">
<xsl:text>noname-attributes</xsl:text>
Expand All @@ -54,11 +53,11 @@ SOFTWARE.
</xsl:if>
<xsl:text>has attribute without a name</xsl:text>
<xsl:text>, line=</xsl:text>
<xsl:value-of select="$attr/@line"/>
<xsl:value-of select="@line"/>
<xsl:text>, pos=</xsl:text>
<xsl:value-of select="$attr/@pos"/>
<xsl:value-of select="@pos"/>
</xsl:element>
</xsl:if>
</xsl:for-each>
</xsl:template>
<xsl:template match="node()|@*">
<xsl:copy>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
xsls:
- /org/eolang/parser/wrap-method-calls.xsl
- /org/eolang/parser/errors/noname-attributes.xsl
tests:
- /program/errors[count(error[@severity='error'])=2]
- /program/errors/error[@line='1']
- /program/errors/error[@line='8']
- //o[@base='first' and @line='2']
- //o[@base='second' and @line='3']
- /program/errors[count(error[@severity='error'])=4]
- /program/errors/error[@line='2' and contains(text(),'pos=2')]
- /program/errors/error[@line='3' and contains(text(),'pos=2')]
- /program/errors/error[@line='9' and contains(text(),'pos=19')]
- /program/errors/error[@line='14' and contains(text(),'pos=2')]
eo: |
[]
first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ eo: |
+version 0.0.0
[] > x
1.times 2 (1.plus other.value)
1.times 2 (1.plus other.value) > @

0 comments on commit 2a42bd2

Please sign in to comment.