Skip to content

Commit

Permalink
objectionary#3238 fix literal sharing between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
c71n93 committed Aug 7, 2024
1 parent 22ba607 commit 59b85c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public final class EOregex$EOpattern$EOmatch$EOmatched_from_index extends PhDefa
/**
* Start.
*/
public static final String START = "start";
private static final String START = "start";

/**
* Position.
*/
public static final String POSITION = "position";
private static final String POSITION = "position";

/**
* Ctor.
Expand Down
20 changes: 8 additions & 12 deletions eo-runtime/src/test/java/EOorg/EOeolang/EOio/EOconsoleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,14 @@
@SuppressWarnings("JTCOP.RuleAllTestsHaveProductionClass")
final class EOconsoleTest {

/**
* Hello.
*/
private static final String HELLO = "Hello";

@Test
@StdIo
void printsFromTuple(final StdOut output) {
final String msg = "Hello";
final Phi tuple = Phi.Φ.take("org").take("eolang").take("tuple");
final Phi copy = tuple.copy();
copy.put(0, tuple.take("empty"));
copy.put(1, new Data.ToPhi(EOconsoleTest.HELLO));
copy.put(1, new Data.ToPhi(msg));
final Phi ret = copy.take("at").copy();
ret.put(0, new Data.ToPhi(0L));
final Phi written = new EOconsole$EOwrite$EOwritten_bytes();
Expand All @@ -69,7 +65,7 @@ void printsFromTuple(final StdOut output) {
MatcherAssert.assertThat(
"The `console.write.written-bytes` object should have printed string from `tuple`, but it didn't",
output.capturedString(),
Matchers.equalTo(EOconsoleTest.HELLO)
Matchers.equalTo(msg)
);
}

Expand All @@ -90,7 +86,7 @@ void dataizesAsTrue() {
@StdIo
void writesToConsoleSequentially(final StdOut output) {
final Phi console = Phi.Φ.take("org.eolang.io.console");
final Phi buffer = new Data.ToPhi(EOconsoleTest.HELLO);
final Phi buffer = new Data.ToPhi("Ha");
final Phi first = new PhWith(
new PhCopy(
new PhMethod(console, "write")
Expand All @@ -107,7 +103,7 @@ void writesToConsoleSequentially(final StdOut output) {
MatcherAssert.assertThat(
"The `console.write` object should have return output block ready to write again, but it didn't",
output.capturedString(),
Matchers.equalTo("HelloHello")
Matchers.equalTo("HaHa")
);
}

Expand All @@ -127,7 +123,7 @@ void readsBytesFromStandardInput(final StdIn input) {
}

@Test
@StdIo(EOconsoleTest.HELLO)
@StdIo("Message")
void readsOnlyAvailableBytes(final StdIn input) {
MatcherAssert.assertThat(
String.join(
Expand All @@ -141,7 +137,7 @@ void readsOnlyAvailableBytes(final StdIn input) {
0, new Data.ToPhi(10)
)
).asString(),
Matchers.equalTo(EOconsoleTest.HELLO.concat(System.lineSeparator()))
Matchers.equalTo("Message".concat(System.lineSeparator()))
);
}

Expand Down Expand Up @@ -175,7 +171,7 @@ void readsByPortionsFromInput() {
0, new Data.ToPhi(5)
)
).asString(),
Matchers.equalTo(EOconsoleTest.HELLO)
Matchers.equalTo("Hello")
);
MatcherAssert.assertThat(
"The object `console.read.read-bytes` should have read second 5 bytes from standard input, but it didn't",
Expand Down

0 comments on commit 59b85c9

Please sign in to comment.