Skip to content

Commit

Permalink
fix(objectionary#3580): remove object
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Dec 11, 2024
1 parent 6aa9ba2 commit 9e5f73e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 33 deletions.
1 change: 0 additions & 1 deletion eo-runtime/src/main/eo/org/eolang/bytes.eo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
data > @
$ > as-bytes
$.eq 01- > as-bool
string $ > as-string

# Turn this chain of eight bytes into a number.
# If there are less or more than eight bytes, there will
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/main/eo/org/eolang/fs/dir.eo
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
[] > tmpfile
if. > @
^.exists
QQ.fs.file touch.as-bytes.as-string
QQ.fs.file
string touch.as-bytes
error
sprintf
"Directory %s does not exist, can't create temporary file"
Expand Down
3 changes: 2 additions & 1 deletion eo-runtime/src/main/eo/org/eolang/fs/file.eo
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@

# Move current file to `target`, making and returning a new `file` from it.
[target] > moved
QQ.fs.file move.as-bytes.as-string > @
QQ.fs.file > @
string move.as-bytes

# Tries to move file from `^.path` to `target`
# and returns path of moved file as `string`.
Expand Down
22 changes: 10 additions & 12 deletions eo-runtime/src/main/eo/org/eolang/fs/path.eo
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Utility object that joins given `tuple` of paths with current OS separator
# and normalizes result path.
[paths] > joined
as-string. > joined-path
string > joined-path
as-bytes.
joined.
text ^.separator
Expand Down Expand Up @@ -132,11 +132,10 @@
--
determined. > @
^.^.posix
as-string.
if.
normalized.eq "//"
"/"
normalized
if.
normalized.eq "//"
"/"
string normalized

# Resolves `other` path against `^.uri` and returns as new `path` from it.
# The original `uri` and resolving `other` may be:
Expand Down Expand Up @@ -269,7 +268,7 @@
"\\" > separator
determined. > @
validated
as-string.
string
as-bytes.
validated.separated-correctly
uri
Expand Down Expand Up @@ -397,11 +396,10 @@
--
determined. > @
^.^.validated
as-string.
if.
normalized.eq "\\\\"
^.separator
normalized
if.
normalized.eq "\\\\"
^.separator
string normalized

# Resolves `other` path against `^.uri` and returns as new `path` from it.
# Original `uri` and `other` path for resolving may be:
Expand Down
24 changes: 12 additions & 12 deletions eo-runtime/src/main/eo/org/eolang/txt/text.eo
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@
^.origin > delimiter!
items.at 0 > first
items.length > len!
if. > not-empty!
1.eq len
first
concat.
first.as-bytes
with-delimiter "".as-bytes 1
text > @
if.
0.eq len
""
if.
1.eq len
first
as-string.
concat.
first.as-bytes
with-delimiter "".as-bytes 1
string not-empty

[acc index] > with-delimiter
if. > @
Expand Down Expand Up @@ -146,7 +146,7 @@
if.
0.eq amount
""
as-string.
string
rec-repeated bts 1

[accum index] > rec-repeated
Expand Down Expand Up @@ -249,7 +249,7 @@
number ascii-a
ascii "A"
text > @
as-string.
string
reduced.
list
bytes-as-array
Expand Down Expand Up @@ -282,7 +282,7 @@
^.up-cased.ascii "Z" > ascii-z
^.up-cased.ascii "A" > ascii-a
text > @
as-string.
string
reduced.
list
bytes-as-array
Expand Down Expand Up @@ -349,7 +349,7 @@
block.from.minus start
^.replacement
block.to
as-string.
string
accum.concat
^.reinit.slice
start
Expand Down Expand Up @@ -404,7 +404,7 @@
0.eq others.length
^
text
as-string.
string
reduced.
list others
^.origin.as-bytes
Expand Down
5 changes: 2 additions & 3 deletions eo-runtime/src/test/eo/org/eolang/bytes-tests.eo
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# This unit test is supposed to check the functionality of the corresponding object.
[] > turns-bytes-into-a-string
eq. > @
as-string.
string
E4-BD-A0-E5-A5-BD-2C-20-D0-B4-D1-80-D1-83-D0-B3-21
"你好, друг!"

Expand Down Expand Up @@ -351,8 +351,7 @@
"hello ".as-bytes
"world".as-bytes
eq. > @
as-string.
s-bytes
string s-bytes
"hello world"

# This unit test is supposed to check the functionality of the corresponding object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@ final class EObytesEOconcatTest {
void concatenatesBytes() {
final Phi current = new Data.ToPhi("привет ").take("as-bytes");
final Phi provided = new Data.ToPhi("mr. ㄤㄠ!").take("as-bytes");
final Phi phi = new PhMethod(
final Phi phi = new PhWith(
Phi.Φ.take("org.eolang.string"),
0,
new PhWith(
current.take("concat").copy(),
"b",
provided
),
"as-string"
)
);
MatcherAssert.assertThat(
AtCompositeTest.TO_ADD_MESSAGE,
Expand Down

0 comments on commit 9e5f73e

Please sign in to comment.