Skip to content

Commit

Permalink
Merge pull request #3679 from objectionary/3677
Browse files Browse the repository at this point in the history
fixing file location in StrictXmir
  • Loading branch information
yegor256 authored Dec 16, 2024
2 parents 03d98f9 + e73273d commit 80f6b0b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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

0 comments on commit 80f6b0b

Please sign in to comment.