Skip to content

Commit 129b17d

Browse files
committed
1 parent cdfa752 commit 129b17d

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

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

+4-11
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public boolean hasRho() {
6969

7070
@Override
7171
public Phi take(final String name) {
72-
final String obj = this.eoPackage(name);
72+
final String obj = String.join(".", this.pkg, name);
7373
final String key = new JavaPath(obj).toString();
7474
return this.objects.computeIfAbsent(
7575
key,
@@ -109,23 +109,16 @@ public byte[] delta() {
109109
throw new ExFailure("Can't take #data() from package object \"%s\"", this.pkg);
110110
}
111111

112-
/**
113-
* Creates eo-package path by name.
114-
* @param name The name of an en object.
115-
* @return Eo-package path.
116-
*/
117-
private String eoPackage(final String name) {
118-
return String.join(".", this.pkg, name);
119-
}
120-
121112
/**
122113
* Load phi object by package name from ClassLoader.
123114
* @param path Path to directory or .java file
124115
* @param object Object FQN
125116
* @return Phi
126117
*/
127118
private Phi loadPhi(final String path, final String object) {
128-
final Path pth = Paths.get("target/classes", path.replace(".", File.separator));
119+
final Path pth = Paths.get(
120+
this.getClass().getResource("/").getPath(), path.replace(".", File.separator)
121+
);
129122
final Phi phi;
130123
if (Files.exists(pth) && Files.isDirectory(pth)) {
131124
phi = new PhPackage(object);

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ final class SnippetIT {
4848
@SuppressWarnings("unchecked")
4949
void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOException {
5050
final Xtory xtory = new XtSticky(new XtYaml(yml));
51-
final String file = xtory.map().get("file").toString();
5251
Assumptions.assumeFalse(xtory.map().containsKey("skip"));
52+
final String file = xtory.map().get("file").toString();
5353
new Farea(temp).together(
5454
f -> {
5555
f.properties()
@@ -67,6 +67,12 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio
6767
).getBytes(StandardCharsets.UTF_8)
6868
);
6969
f.dependencies().appendItself();
70+
final String target;
71+
if (xtory.map().containsKey("target")) {
72+
target = xtory.map().get("target").toString();
73+
} else {
74+
target = "target";
75+
}
7076
f.build()
7177
.plugins()
7278
.append(
@@ -91,7 +97,7 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio
9197
.configuration()
9298
.set("mainClass", "org.eolang.Main")
9399
.set("arguments", xtory.map().get("args"));
94-
f.exec("clean", "test");
100+
f.exec("clean", "test", "-Dproject.build.directory='hello'");
95101
MatcherAssert.assertThat(
96102
String.format("'%s' printed something wrong", yml),
97103
f.log().content(),

0 commit comments

Comments
 (0)