Skip to content

Commit

Permalink
tests fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Dec 8, 2024
1 parent 79ab1b7 commit cd2e432
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
13 changes: 1 addition & 12 deletions eo-parser/src/main/resources/XMIR.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,6 @@ SOFTWARE.
<xs:pattern value="[0-9]+|@|[a-z]\S*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="function-name">
<xs:annotation>
<xs:appinfo>A name of function in the atom</xs:appinfo>
<xs:documentation>
The name of a function in the atom, which is used to reference the function from other objects or from the global scope.
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]\S*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="fqn">
<xs:annotation>
<xs:appinfo>A fully qualified name of an object</xs:appinfo>
Expand Down Expand Up @@ -182,7 +171,7 @@ SOFTWARE.
</xs:annotation>
</xs:attribute>
<xs:attribute name="as" type="attribute-name"/>
<xs:attribute name="atom" type="function-name"/>
<xs:attribute name="atom" type="fqn"/>
<xs:attribute name="loc" type="locator"/>
<!--
The following three are definitely temporary and should
Expand Down
17 changes: 12 additions & 5 deletions eo-parser/src/test/java/org/eolang/parser/EoSyntaxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
import com.jcabi.xml.XMLDocument;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Set;
import org.cactoos.io.InputOf;
import org.cactoos.io.ResourceOf;
import org.cactoos.iterable.Mapped;
import org.cactoos.set.SetOf;
import org.cactoos.text.TextOf;
import org.eolang.jucs.ClasspathSource;
import org.eolang.xax.XtSticky;
Expand Down Expand Up @@ -287,13 +289,18 @@ void checksXsdMistakes(final String yaml) throws Exception {
);
Assumptions.assumeTrue(story.map().get("skip") == null);
final XML xml = story.after();
final Collection<SAXParseException> errors = xml.validate(
new XMLDocument(
new TextOf(new ResourceOf("XMIR.xsd")).asString()
final Set<String> errors = new SetOf<>(
new Mapped<>(
SAXParseException::toString,
xml.validate(
new XMLDocument(
new TextOf(new ResourceOf("XMIR.xsd")).asString()
)
)
)
);
MatcherAssert.assertThat(
Logger.format("correct number of errors found: %[list]s", errors),
Logger.format("correct number of errors found: %[list]s%n%s", errors, yaml),
errors,
Matchers.iterableWithSize(
Integer.parseInt(story.map().get("errors").toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ errors: 2
document: |
<program name='foo'>
<objects>
<o name="foo" atom="wrong-function-name"/>
<o name="foo" atom="Wrong Object Name"/>
</objects>
</program>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
errors: 2
errors: 1
document: |
<program>
<objects/>
Expand Down

0 comments on commit cd2e432

Please sign in to comment.