Skip to content

Commit

Permalink
#3549: mostly fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 25, 2024
1 parent 424237c commit a75f8a3
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 38 deletions.
15 changes: 8 additions & 7 deletions eo-maven-plugin/src/main/java/org/eolang/maven/UnphiMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
import java.nio.file.Paths;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.cactoos.experimental.Threads;
import org.cactoos.iterable.IterableEnvelope;
import org.cactoos.iterable.Joined;
import org.cactoos.iterable.Mapped;
import org.cactoos.list.ListOf;
import org.cactoos.number.SumOf;
import org.cactoos.set.SetOf;
import org.cactoos.text.TextOf;
Expand Down Expand Up @@ -107,7 +107,7 @@ public final class UnphiMojo extends SafeMojo {

@Override
public void exec() {
final List<String> errors = new ListOf<>();
final List<String> errors = new CopyOnWriteArrayList<>();
final Home home = new HmBase(this.unphiOutputDir);
final Iterable<Directive> metas = new UnphiMojo.Metas(this.unphiMetas);
final Xsline xsline = new Xsline(this.measured(UnphiMojo.TRANSFORMATIONS));
Expand Down Expand Up @@ -136,11 +136,11 @@ public void exec() {
"Parsed to xmir: %[file]s -> %[file]s",
phi, this.unphiOutputDir.toPath().resolve(xmir)
);
if (result.nodes("//errors[count(error)=0]").isEmpty()) {
if (!result.nodes("//errors/error").isEmpty()) {
errors.add(
String.format(
"%s:\n\t%s\n",
relative,
Logger.format(
"%[file]s:\n\t%s\n",
xmir,
String.join("\n\t", result.xpath("//errors/error/text()"))
)
);
Expand Down Expand Up @@ -192,7 +192,8 @@ private static class Metas extends IterableEnvelope<Directive> {
);
}
final Directives dirs = new Directives()
.xpath("/program/metas")
.xpath("/program")
.addIf("metas")
.add("meta")
.add("head").set(head).up()
.add("tail");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ SOFTWARE.
[args] &gt; main
(stdout "Hello!").print
</listing>
<errors/>
<sheets/>
<metas>
<meta line="1">
<head>package</head>
Expand All @@ -50,4 +48,4 @@ SOFTWARE.
<o base=".print" line="4" method="" pos="19"/>
</o>
</objects>
</program>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<program name="main">
<errors/>
<objects>
<o abstract="" line="3" name="main" original-name="main" pos="0">
<o line="3" name="args" pos="1"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,6 @@ SOFTWARE.
}</listing>
<errors/>
<sheets/>
<license/>
<metas>
<meta>
<head>package</head>
Expand Down Expand Up @@ -2619,4 +2616,4 @@ SOFTWARE.
</o>
</o>
</objects>
</program>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ SOFTWARE.
[] &gt; foo
this-d.plus 1 &gt; @
</listing>
<errors/>
<sheets/>
<license/>
<metas/>
<objects>
<o abstract="" line="6" name="a" pos="0">
<o line="6" name="d" pos="1"/>
Expand All @@ -59,4 +55,4 @@ SOFTWARE.
</o>
</o>
</objects>
</program>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ SOFTWARE.
[] &gt; foo
this-a.foo.plus 2 &gt; @
</listing>
<errors/>
<sheets/>
<license/>
<metas/>
<objects>
<o abstract="" line="13" name="b" pos="0">
<o line="13" name="a" pos="1"/>
Expand All @@ -65,4 +61,4 @@ SOFTWARE.
</o>
</o>
</objects>
</program>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ SOFTWARE.
[args...] &gt; main
b.new (a.new 42) 21
</listing>
<errors/>
<sheets/>
<license/>
<metas/>
<objects>
<o abstract="" line="1" name="main" pos="0">
<o abstract="" line="2" name="main" pos="2">
Expand All @@ -58,4 +54,4 @@ SOFTWARE.
</o>
</o>
</objects>
</program>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# SOFTWARE.
---
tests:
- //errors[count(error)=0]
- /program[not(errors)]
phi: |-
{
Expand Down
2 changes: 0 additions & 2 deletions eo-parser/src/test/java/org/eolang/parser/StEoLoggedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ private static XML example() {
String.join(
"\n",
"<program>",
" <errors/>",
" <sheets/>",
" <objects>",
" <o abstract=\"\" line=\"1\" name=\"main\" pos=\"0\">",
" <o base=\"true\" line=\"2\" name=\"x\" pos=\"2\"/>",
Expand Down
2 changes: 0 additions & 2 deletions eo-parser/src/test/java/org/eolang/parser/TrParsingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ void passesPipelineEvenWithErrors() {
String.join(
"\n",
"<program>",
" <errors/>",
" <sheets/>",
" <objects>",
" <o abstract=\"\" line=\"1\" name=\"main\" pos=\"0\">",
" <o base=\"bool\" data=\"bytes\" line=\"2\" name=\"x\" pos=\"2\">01</o>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47356,9 +47356,6 @@ SOFTWARE.
}</listing>
<errors/>
<sheets/>
<license/>
<metas>
<meta>
<head>package</head>
Expand Down

0 comments on commit a75f8a3

Please sign in to comment.