Skip to content

Commit 7045c62

Browse files
committed
bug(objectionary#3986): simple snippet test
1 parent b1483ea commit 7045c62

File tree

5 files changed

+29
-6
lines changed

5 files changed

+29
-6
lines changed

eo-runtime/src/main/java/org/eolang/Main.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ private static void run(final List<String> opts) throws Exception {
162162
}
163163
final Phi app = Phi.Φ.take(obj);
164164
if (opts.size() > 1) {
165-
Phi args = Phi.Φ.take("org.eolang.tuple");
165+
Phi args = Phi.Φ.take("org.eolang.tuple").take("empty");
166166
for (int idx = 1; idx < opts.size(); ++idx) {
167167
args = args.take("with");
168168
args.put(0, new Data.ToPhi(opts.get(idx)));

eo-runtime/src/main/java/org/eolang/PhPackage.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ public byte[] delta() {
117117
*/
118118
private Phi loadPhi(final String path, final String object) {
119119
final Path pth = Paths.get(
120-
this.getClass().getResource("/").getPath(), path.replace(".", File.separator)
120+
this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(),
121+
path.replace(".", File.separator)
121122
);
122123
final Phi phi;
123124
if (Files.exists(pth) && Files.isDirectory(pth)) {

eo-runtime/src/test/java/integration/SnippetIT.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio
7373
} else {
7474
target = "target";
7575
}
76+
f.build()
77+
.properties()
78+
.set("directory", target);
7679
f.build()
7780
.plugins()
7881
.append(
@@ -97,7 +100,7 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio
97100
.configuration()
98101
.set("mainClass", "org.eolang.Main")
99102
.set("arguments", xtory.map().get("args"));
100-
f.exec("clean", "test", "-Dproject.build.directory='hello'");
103+
f.exec("clean", "test");
101104
MatcherAssert.assertThat(
102105
String.format("'%s' printed something wrong", yml),
103106
f.log().content(),

eo-runtime/src/test/resources/org/eolang/snippets/fibo.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@ eo: |
99
+alias org.eolang.io.stdout
1010
+alias org.eolang.txt.sprintf
1111
+package org.eolang.snippets
12-
+unlint object-has-data
13-
+unlint broken-alias-second
1412
1513
# No comments.
16-
[args] > fibo
14+
[] > fibo
1715
# No comments.
1816
[n] > f
1917
if. > @
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com
2+
# SPDX-License-Identifier: MIT
3+
---
4+
out:
5+
- ".*Hello, Jeff.*"
6+
- ".*eoc/classes.*"
7+
- ".*eoc/eo/5-resolve.*"
8+
- ".*eoc/eo-foreign.csv.*"
9+
file: simple.eo
10+
args: [ "simple", "Jeff" ]
11+
target: "eoc"
12+
eo: |
13+
+alias org.eolang.io.stdout
14+
+alias org.eolang.txt.sprintf
15+
16+
# No comments.
17+
[args] > simple
18+
stdout > @
19+
sprintf *1
20+
"Hello, %s"
21+
args.at 0

0 commit comments

Comments
 (0)