Skip to content

Test suite: Permit editorconfig programs to provide correct output lines in any order #375

@cxw42

Description

@cxw42

At least the lowercase-value tests beginning here check for two or more lines of output in succession using ^(line1)(line2)$ (in essence). This requires that line1 and line2 be output in that order. (CMake regex reference)

However, I cannot find any documentation here, in the editorconfig-core-test issues, in #22 , on https://editorconfig.org, or in the Doxygen output, that specifies that requirement.

As far as I can tell, the test requires the options be output in the same order they are given in the .editorconfig file. Is that indeed a requirement? It seems somewhat brittle to me.

Would it be possible to change the spec and tests so that the output lines from the editorconfig program can appear in any order?

Edit

Adding both orders to the test case is a brute-force option, but it works. For example:

new_ec_test(lowercase_values1 lowercase_values.in test1.c
    "(^indent_style=space[ \t]*[\n\r]+end_of_line=crlf[ \t\n\r]*$)|(^end_of_line=crlf[ \t\n\r]+indent_style=space[ \t]*[\n\r]*$)"
    )                                                            #^ the part starting here is new

Edit 2 The linked commit is a better way to fix it, in my opinion - test for each line with a separate regex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions