Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Jan 17, 2024
2 parents 5cd4367 + 70dd771 commit a2a2038
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 10 deletions.
54 changes: 54 additions & 0 deletions eo-runtime/src/test/eo/org/eolang/io/tupled-stdout-test.eo
@@ -0,0 +1,54 @@
# The MIT License (MIT)
#
# Copyright (c) 2016-2023 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

+alias org.eolang.io.tupled-stdout
+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+tests
+package org.eolang.io
+version 0.0.0

[] > tupled-stdout-single
tupled-stdout > @
*
"Hello, world! Single tupled.\n"

[] > tupled-stdout-several
tupled-stdout > @
*
"Hello"
", "
"world"
"! "
"Several "
"tupled.\n"

[] > tupled-stdout-empty
eq. > @
try
[]
tupled-stdout > @
*
[e]
e > @
nop
"tuple of arguments must contain at least one element"
51 changes: 51 additions & 0 deletions eo-runtime/src/test/eo/org/eolang/io/tupled-stdout.eo
@@ -0,0 +1,51 @@
# The MIT License (MIT)
#
# 2016-2022 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

+alias org.eolang.io.stdout
+architect yegor256@gmail.com
+home https://github.com/objectionary/eo
+package org.eolang.io
+version 0.0.0

# An object for testing entire applications that accepts arguments in the form of a tuple.
[args] > tupled-stdout
memory 0 > iter
args.length.minus 1 > max
if. > @
max.lt 0
error "tuple of arguments must contain at least one element"
if.
max.eq 0
stdout
args.at
0
while.
iter.as-int.lt max
[i]
seq > @
*
stdout
args.at
i
iter.write
iter.as-int.plus 1
TRUE
12 changes: 2 additions & 10 deletions eo-runtime/src/test/java/org/eolang/MainTest.java
Expand Up @@ -40,12 +40,6 @@
* Test case for {@link Main}.
*
* @since 0.1
* @todo #2718:30min Enable the tests. Tests {@link MainTest#deliversCleanOutput()} and
* {@link MainTest#executesJvmFullRun()} were disabled because they execute "org.eolang.io.stdout"
* object that accepts "string". But arguments after "org.eolang.io.stdout" are stored into "tuple"
* and are being passed as "tuple" object. And here we get the situation where
* "stdout" accepts "tuple" and fails. We need to enable the test by finding object that accepts
* "tuple" as the first argument, or make a custom one.
*/
final class MainTest {

Expand All @@ -69,19 +63,17 @@ void printsHelp() {
}

@Test
@Disabled
void deliversCleanOutput() {
MatcherAssert.assertThat(
MainTest.exec("org.eolang.io.stdout", "Hello!"),
MainTest.exec("org.eolang.io.tupled-stdout", "Hello!"),
Matchers.equalTo(String.format("Hello!%n---%n%s%n", Arrays.toString(new byte[]{0x01})))
);
}

@Test
@Disabled
void executesJvmFullRun() {
MatcherAssert.assertThat(
MainTest.exec("--verbose", "org.eolang.io.stdout", "Hello, dude!"),
MainTest.exec("--verbose", "org.eolang.io.tupled-stdout", "Hello, dude!"),
Matchers.allOf(
Matchers.containsString("EOLANG"),
Matchers.containsString("Hello, "),
Expand Down

1 comment on commit a2a2038

@0pdd
Copy link

@0pdd 0pdd commented on a2a2038 Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 2718-833aa636 disappeared from eo-runtime/src/test/java/org/eolang/MainTest.java), that's why I closed #2723. Please, remember that the puzzle was not necessarily removed in this particular commit. Maybe it happened earlier, but we discovered this fact only now.

Please sign in to comment.