Skip to content

Lints incorrectly treating --prefixed throwing tests as ordinary objects #1129

Description

@yegor256

The EO parser marks a truthy test attribute (++> name) by prefixing its
@name with +, and a throwing test attribute (--> name) by prefixing it
with - (see Suffix.attribute in eo-parser). Three lints know about the
first prefix only, so every throwing test is linted as if it were an ordinary
object: names/non-kebab-name.xsl:14, misc/sparse-decoration.xsl:17 and
tests/wrong-test-order.xsl:14 all filter on starts-with(@name, '+').

On eo-runtime of objectionary/eo this produces 236 bogus warnings out of
338: 98 non-kebab-name ("Formation name
-on-bytes-of-wrong-size-as-i16 must be in kebab-case" — the leading hyphen
is the marker, not part of the name), 95 sparse-decoration (a throwing test
such as 01-01-01.as-i16 --> on-bytes-of-wrong-size-as-i16 is a single-φ
formation by construction, exactly the case starts-with(@name, '+') already
excuses for truthy tests), and 43 wrong-test-order (the last ++> test in a
file is reported as misplaced because the --> tests that follow it are not
counted as tests).

The smallest fix is to widen the three predicates from
starts-with(@name, '+') to also accept -, ideally through one shared
eo:test-name() function in org/eolang/funcs/, since
misc/incorrect-test-object-name.xsl:14,
names/unsorted-named-attributes.xsl:14,
tests/unit-test-without-phi.xsl:14 and tests/unit-test-missing.xsl:14
carry the same assumption and will need it too.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood-titleThe title was checked and improved by ChatGPT

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions