Skip to content

Commit

Permalink
#2660: tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 22, 2023
1 parent a6a3e82 commit 4e043dd
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion eo-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ SOFTWARE.
<dependency>
<groupId>com.yegor256</groupId>
<artifactId>farea</artifactId>
<version>0.0.11</version>
<version>0.0.12</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ final class SnippetTestCase {
void runsAllSnippets(final String yml) throws IOException {
final Yaml yaml = new Yaml();
final Map<String, Object> map = yaml.load(yml);
final String file = map.get("file").toString();
Assumptions.assumeFalse(map.containsKey("skip"));
new Farea(this.temp).together(
f -> {
Expand All @@ -98,14 +99,16 @@ void runsAllSnippets(final String yml) throws IOException {
.set("project.build.sourceEncoding", "UTF-8")
.set("project.reporting.outputEncoding", "UTF-8");
f.files()
.file("src/main/eo/main.eo")
.file(String.format("src/main/eo/%s", file))
.write(String.format("%s\n", map.get("eo")))
.show();
f.build()
.plugins()
.appendItself()
.phase("generate-sources")
.goals("register", "assemble", "verify", "transpile");
.goals("register", "assemble", "verify", "transpile")
.configuration()
.set("failOnWarnings", "true");
f.build()
.plugins()
.append("org.codehaus.mojo", "exec-maven-plugin", "3.1.1")
Expand All @@ -114,6 +117,7 @@ void runsAllSnippets(final String yml) throws IOException {
.configuration()
.set("mainClass", "org.eolang.Main")
.set("arguments", map.get("args"));
f.exec("clean");
f.exec("test");
MatcherAssert.assertThat(
String.format("'%s' printed something wrong", yml),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
out:
- ".*works!.*"
args: ["foo.main"]
file: org/eolang/snippets/all.eo
args: ["org.eolang.snippets.all"]
eo: |
+package foo
+package org.eolang.snippets
[args] > main
[args] > all
seq > a
*
42
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
skip: true
file: org/eolang/snippets/fibo.eo
out:
- ".*8 is the 6th number.*"
args: [ "main" ]
args: [ "org.eolang.snippets.fibo" ]
eo: |
+package org.eolang.snippets
+alias org.eolang.io.stdout
[args] > main
[args] > fibo
[n] > f
if. > @
n.lt 2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
out:
- ".*greater.*"
args: [ "main", "17" ]
file: org/eolang/snippets/ifthenelse.eo
args: [ "org.eolang.snippets.ifthenelse", "17" ]
eo: |
+package org.eolang.snippets
+alias org.eolang.io.stdout
[args] > main
[args] > ifthenelse
[n] > f
if. > @
n.lt 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
file: org/eolang/snippets/parenting.eo
skip: true
out:
- ".*123.*"
args: [ "main", "123" ]
args: [ "org.eolang.snippets.parenting", "123" ]
eo: |
+package org.eolang.snippets
+alias org.eolang.io.stdout
[args] > main
[args] > parenting
"The code snippet that checks parent's args" > description
[] > take
^.args.at 0 > @
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
out:
- ".*Hello, Jeff!.*"
args: ["simple.main"]
file: org/eolang/snippets/simple.eo
args: ["org.eolang.snippets.simple"]
eo: |
+package simple
+package org.eolang.snippets
+alias org.eolang.io.stdout
[args] > main
[args] > simple
seq > @
*
stdout
Expand Down

0 comments on commit 4e043dd

Please sign in to comment.