Skip to content

Commit

Permalink
bug(objectionary#3946): runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Feb 26, 2025
1 parent 3c754e1 commit 36fcc0a
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<!-- Get name for special attributes -->
<xsl:function name="eo:attr-name" as="xs:string">
<xsl:param name="n" as="xs:string"/>
<xsl:param name="wrap" select="false()" as="xs:boolean"/>
<xsl:param name="wrap" as="xs:boolean"/>
<xsl:variable name="alpha" select="starts-with($n, $eo:alpha)"/>
<xsl:variable name="name">
<xsl:choose>
Expand All @@ -96,9 +96,12 @@
<xsl:value-of select="$name"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>"</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>"</xsl:text>
<xsl:variable name="quoted">
<xsl:text>"</xsl:text>
<xsl:value-of select="$name"/>
<xsl:text>"</xsl:text>
</xsl:variable>
<xsl:value-of select="$quoted"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ asserts:
- //java[contains(text(), 'Phi rb1 = Phi.Φ.take("org").take("eolang").take("number");')]
- //java[contains(text(), 'Phi rb11 = Phi.Φ.take("org").take("eolang").take("bytes").copy();')]
- //java[contains(text(), 'Phi r = new PhMethod(rb, "and");')]
- //java[contains(text(), 'Phi r = new PhMethod(rb, 0);')]
- //java[contains(text(), 'r = new PhMethod(r, 2);')]
input: |
# Comment.
[] > foo
Expand All @@ -26,4 +26,4 @@ input: |
x.
$
2
q.~0 > w
q.~2 > w
12 changes: 6 additions & 6 deletions eo-parser/src/main/java/org/eolang/parser/Objects.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@ final class Objects implements Iterable<Directive> {
*/
private final Directives dirs = new Directives();

@Override
public Iterator<Directive> iterator() {
return this.dirs.iterator();
}

/**
* Start new object.
* @param line At line.
* @param pos At position.
* @return Self.
*/
public Objects start(final int line, final int pos) {
Objects start(final int line, final int pos) {
this.dirs.add("o");
return this.prop("line", line).prop("pos", pos);
}
Expand Down Expand Up @@ -88,9 +93,4 @@ Objects leave() {
this.dirs.up();
return this;
}

@Override
public Iterator<Directive> iterator() {
return this.dirs.iterator();
}
}
5 changes: 0 additions & 5 deletions eo-parser/src/test/java/org/eolang/parser/XmirTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import com.jcabi.matchers.XhtmlMatchers;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import java.io.IOException;
import org.cactoos.io.InputOf;
import org.eolang.jucs.ClasspathSource;
Expand All @@ -15,11 +14,7 @@
import org.eolang.xax.Xtory;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.xembly.Directives;
import org.xembly.Xembler;

/**
* Test case for {@link Xmir}.
Expand Down
2 changes: 1 addition & 1 deletion eo-runtime/src/main/java/org/eolang/Phi.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface Phi extends Data {
Phi take(String name);

/**
* Take object by position of the attribute
* Take object by position of the attribute.
* @param pos The position of the attribute
* @return The object
*/
Expand Down
8 changes: 8 additions & 0 deletions eo-runtime/src/test/eo/org/eolang/runtime-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ true > global-test
.as-bytes:0
"first"

# This unit test is supposed to check the functionality of the corresponding object.
[] > tests-methods-by-position
[first second] > obj
obj 1 "Hey" > bound
and. > @
bound.~0.eq 1
bound.~1.eq "Hey"

# This unit test is supposed to check the functionality of the corresponding object.
[] > tests-nesting-blah-test
blah0 > @
Expand Down
2 changes: 1 addition & 1 deletion eo-runtime/src/test/java/integration/SnippetIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void runsAllSnippets(final String yml, final @Mktmp Path temp) throws IOExceptio
)
.execution("compile")
.phase("generate-sources")
.goals("register", "assemble", "lint", "transpile")
.goals("register", "compile", "transpile")
.configuration()
.set("failOnWarning", Boolean.FALSE.toString());
f.build()
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skipTests>${skipITs}</skipTests>
<forkCount>1.0C</forkCount>
<reuseForks>true</reuseForks>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 36fcc0a

Please sign in to comment.