Skip to content

Commit

Permalink
feat(#757): do not roll the data
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed Oct 15, 2024
1 parent 58bb807 commit cedbc5c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ private static XML unroll(final XML parsed) {
),
new TrClasspath<>(
"/org/eolang/parser/add-refs.xsl",
"/org/eolang/parser/vars-float-down.xsl",
"/org/eolang/parser/roll-data.xsl"
"/org/eolang/parser/vars-float-down.xsl"
).back()
)
).pass(parsed);
Expand Down
51 changes: 51 additions & 0 deletions src/test/java/org/eolang/jeo/representation/CanonicalXmirTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.eolang.jeo.representation;

import com.jcabi.matchers.XhtmlMatchers;
import com.jcabi.xml.XMLDocument;
import java.util.Collections;
import org.eolang.jeo.representation.bytecode.BytecodeClass;
Expand All @@ -34,6 +35,7 @@
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.xembly.Directives;
import org.xembly.ImpossibleModificationException;
import org.xembly.Xembler;

Expand Down Expand Up @@ -73,4 +75,53 @@ void transformsToPlainXmir() throws ImpossibleModificationException {
Matchers.equalTo(initial)
);
}

@Test
void unrollsSequenceOfValuesCorrectly() {
MatcherAssert.assertThat(
"We expect that after the unrolling we will get correct sequence of string values.",
new CanonicalXmir(
new XMLDocument(
new Xembler(
new Directives()
.add("program")
.add("objects")
.append(
new XMLDocument(
String.join(
"\n",
"<o base='.seq1' name='interfaces'> ",
" <o base='.eolang'> ",
" <o base='.org'> ",
" <o base='Q'/></o> ",
" </o> ",
" <o as='0' base='.string'> ",
" <o base='.jeo'> ",
" <o base='.eolang'> ",
" <o base='.org'> ",
" <o base='Q'/></o> ",
" </o> ",
" </o> ",
" <o as='0' base='.bytes'> ",
" <o base='.eolang'> ",
" <o base='.org'> ",
" <o base='Q'/></o> ",
" </o> ",
" <o base='org.eolang.bytes' data='bytes'>6A 61 76 61 2F 69 6F 2F 43 6C 6F 73 65 61 62 6C 65</o> ",
" </o> ",
" </o> ",
"</o>"
)
).node()
)
.up()
.up()
).xmlQuietly()
)
).plain().toString(),
XhtmlMatchers.hasXPath(
".//o[@base='org.eolang.seq1']/o[@base='org.eolang.jeo.string']/o[@base='bytes']"
)
);
}
}

0 comments on commit cedbc5c

Please sign in to comment.