Skip to content

Commit

Permalink
fix(#2778): tests + unphi
Browse files Browse the repository at this point in the history
  • Loading branch information
maxonfjvipon committed Jan 17, 2024
1 parent 5b52995 commit ea3933d
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 24 deletions.
Expand Up @@ -91,7 +91,7 @@ public final class PhiMojo extends SafeMojo {
* This flag is used for test in order not to optimize XMIR twice:
* in {@link OptimizeMojo} and here.
*/
private boolean phiOptimize;
private boolean phiOptimize = true;

@Override
public void exec() {
Expand Down
Expand Up @@ -238,6 +238,7 @@ public <T extends AbstractMojo> FakeMaven execute(final Class<T> mojo) throws IO
this.params.putIfAbsent("objectionaries", new Objectionaries.Fake());
this.params.putIfAbsent("rewriteBinaries", true);
this.params.putIfAbsent("offline", false);
this.params.putIfAbsent("phiOptimize", false);
this.params.putIfAbsent(
"eoPortalDir",
new File("../eo-runtime/src/main/rust/eo")
Expand Down
23 changes: 7 additions & 16 deletions eo-maven-plugin/src/test/java/org/eolang/maven/PhiMojoTest.java
Expand Up @@ -64,27 +64,18 @@ void createsFiles(@TempDir final Path temp) throws Exception {
@ClasspathSource(value = "org/eolang/maven/phi", glob = "**.yaml")
void checksPhiPacks(final String pack, @TempDir final Path temp) throws Exception {
final Map<String, Object> map = new Yaml().load(pack);
String phi = new TextOf(
new FakeMaven(temp)
.withProgram(map.get("eo").toString())
.execute(new FakeMaven.Phi())
.result()
.get("target/phi/foo/x/main.phi")
).asString();
System.out.println(phi);
MatcherAssert.assertThat(
String.format(
"Result phi expression should be equal to %s, but it doesn't",
map.get("phi").toString()
),
phi,
// new TextOf(
// new FakeMaven(temp)
// .withProgram(map.get("eo").toString())
// .execute(new FakeMaven.Phi())
// .result()
// .get("target/phi/foo/x/main.phi")
// ).asString(),
new TextOf(
new FakeMaven(temp)
.withProgram(map.get("eo").toString())
.execute(new FakeMaven.Phi())
.result()
.get("target/phi/foo/x/main.phi")
).asString(),
Matchers.equalTo(map.get("phi").toString())
);
}
Expand Down
Expand Up @@ -6,4 +6,4 @@ phi: |
Δ ⤍ 00-00-00-00-00-00-00-05
)
)
}
}
2 changes: 1 addition & 1 deletion eo-parser/src/main/resources/XMIR.xsd
Expand Up @@ -106,7 +106,7 @@ SOFTWARE.
<xs:element name="tail" type="xs:string"/>
<xs:element name="part" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="line" type="xs:decimal"/>
<xs:attribute name="line"/>
<xs:attribute name="expanded"/>
</xs:complexType>
</xs:element>
Expand Down
Expand Up @@ -40,9 +40,6 @@ SOFTWARE.
<xsl:attribute name="severity">
<xsl:text>error</xsl:text>
</xsl:attribute>
<xsl:attribute name="msg">
<xsl:value-of select="$package"/>
</xsl:attribute>
<xsl:text>Weak typing /? is allowed only inside org.eolang package</xsl:text>
</xsl:element>
</xsl:for-each>
Expand Down
Expand Up @@ -73,8 +73,8 @@ void stopsPipeline() {
new ParsingTrain()
).pass(xml),
XhtmlMatchers.hasXPaths(
"/program/sheets[count(sheet)=2]",
"/program/errors/error[@severity='critical']"
"/program/sheets[count(sheet)=3]",
"/pro gram/errors/error[@severity='critical']"
)
);
}
Expand Down

0 comments on commit ea3933d

Please sign in to comment.