Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing file location in StrictXmir #3679

Merged
merged 2 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eo-parser/src/main/java/org/eolang/parser/StrictXmir.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static XML reset(final XML xml, final Path tmp) {
tmp.resolve(
uri.substring(uri.lastIndexOf('/') + 1)
)
).toString().replace("\\", "/")
).getAbsoluteFile().toString().replace("\\", "/")
);
}
new Xembler(
Expand Down
17 changes: 17 additions & 0 deletions eo-parser/src/test/java/org/eolang/parser/StrictXmirTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.yegor256.MktmpResolver;
import com.yegor256.WeAreOnline;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -64,6 +65,22 @@ void validatesXmir(@Mktmp final Path tmp) {
);
}

@Test
@ExtendWith(MktmpResolver.class)
@ExtendWith(WeAreOnline.class)
void refersToAbsoluteFileName(@Mktmp final Path tmp) {
MatcherAssert.assertThat(
"XSD location must be absolute",
Paths.get(
new StrictXmir(StrictXmirTest.xmir("https://www.eolang.org/XMIR.xsd"), tmp)
.xpath("/program/@xsi:noNamespaceSchemaLocation")
.get(0)
.substring("file:///".length())
).isAbsolute(),
Matchers.is(true)
);
}

@Test
@ExtendWith(MktmpResolver.class)
void validatesXmirWithLocalSchema(@Mktmp final Path tmp) {
Expand Down
Loading