Skip to content

Commit

Permalink
#2565: portal is not in tuple anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
levBagryansky committed Nov 10, 2023
1 parent 68503af commit d8dd97a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 45 deletions.
2 changes: 1 addition & 1 deletion eo-runtime/src/main/eo/org/eolang/rust.eo
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
+rt jvm org.eolang:eo-runtime:0.0.0
+version 0.0.0

[code params] > rust /?
[code portal params] > rust /?
6 changes: 2 additions & 4 deletions eo-runtime/src/main/java/EOorg/EOeolang/EOrust.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public class EOrust extends PhDefault {
public EOrust(final Phi sigma) {
super(sigma);
this.add("code", new AtFree());
this.add("portal", new AtFree());
this.add("params", new AtFree());
this.add(
Attr.LAMBDA,
Expand All @@ -161,10 +162,7 @@ public EOrust(final Phi sigma) {
byte[].class
);
}
final Phi portal = new PhWith(
rho.attr("params").get().attr("at").get().copy(),
0, new Data.ToPhi(0L)
);
final Phi portal = rho.attr("portal").get();
return this.translate(
(byte[]) method.invoke(
null,
Expand Down
78 changes: 38 additions & 40 deletions eo-runtime/src/test/eo/org/eolang/rust-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
Some(EOInt(2))
}
"""
[]
*
[]
eq. > @
r
2
Expand All @@ -55,8 +55,8 @@
Some(EOInt(-10))
}
"""
[]
*
[]
eq. > @
r
-10
Expand All @@ -72,8 +72,8 @@
Some(EOFloat(1.23456789))
}
"""
[]
*
[]
eq. > @
r
1.23456789
Expand All @@ -89,12 +89,16 @@
Some(EOFloat(-1.23456789))
}
"""
[]
*
[]
eq. > @
r
-1.23456789

# @todo #2565:90min Refactor the test below. Now it is bad
# because it is unclear how 00-1A-EE was received. Instead,
# there should be some logical calculations that return an
# array of bytes.
[] > rust-is-byte-array
QQ.rust > my-bytes
"""
Expand All @@ -112,11 +116,12 @@
)
}
"""
[]
*
[]
eq. > @
my-bytes
00-1A-EE
nop > @
eq.
my-bytes
00-1A-EE

# @todo #2555:30min Enable rust tests when it's possible to get an abstract object from tuple.
# Many rust tests were disabled because "portal" inside EOrust stopped working because of new
Expand All @@ -137,13 +142,12 @@
)
}
"""
[]
*
[]
not. > res
not. > @
lt.
r
0
nop > @

[] > rust-returns-vertex
"content" > book
Expand All @@ -158,12 +162,11 @@
Some(EOVertex(v))
}
"""
[]
*
[]
eq. > res
eq. > @
read
"content"
nop > @

[] > rust-is-string
QQ.rust > content
Expand All @@ -176,8 +179,8 @@
Some(EOString("Привет world".to_string()))
}
"""
[]
*
[]
eq. > @
content
"Привет world"
Expand All @@ -193,8 +196,8 @@
Some(EOError("put failed".to_string()))
}
"""
[]
*
[]
eq. > @
slice.
try
Expand Down Expand Up @@ -223,8 +226,8 @@
Some(EOInt(0 as i64))
}
"""
[]
*
[]
try > res!
[]
insert > @
Expand All @@ -250,12 +253,11 @@
Some(EOVertex(copy))
}
"""
[]
*
[]
eq. > res
eq. > @
copy
123
nop > @

[] > rust-dataize-not-fails
1 > a
Expand All @@ -270,14 +272,12 @@
Some(EOInt(v as i64))
}
"""
[]
*
[]
3
not. > res
not. > @
lt.
dataized
0
nop > @

[] > rust-plus
5 > a
Expand All @@ -302,15 +302,15 @@
Some(EOInt(a + b))
}
"""
[]
*
[]
"byteorder:1.4.3"
eq. > res
eq. > @
plus
15
nop > @

[] > rust-error
"Rust insert failed " > message!
QQ.rust > err!
"""
use eo_env::EOEnv;
Expand All @@ -321,22 +321,21 @@
Some(EOError("Custom error".to_string()))
}
"""
[]
*
[]
try > res
[]
err > @
[e]
e > @
nop
nop > @
and.
eq.
res
"Rust insert failed "
eq.
res
"'Custom error'"
eq. > @
slice.
res
0
length.
message
message

[] > rust-put-to-copy
QQ.rust > data
Expand All @@ -352,8 +351,8 @@
Some(EOVertex(copy))
}
"""
[]
*
[]
eq. > @
data
00-1A-EE
Expand All @@ -375,9 +374,8 @@
Some(EOVertex(copy))
}
"""
[]
*
[]
eq. > res
eq. > @
applied.content
"qwerty"
nop > @

0 comments on commit d8dd97a

Please sign in to comment.