Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect test? #37

Closed
dail8859 opened this issue Apr 14, 2020 · 6 comments
Closed

Incorrect test? #37

dail8859 opened this issue Apr 14, 2020 · 6 comments

Comments

@dail8859
Copy link
Member

Been fighting with these two tests.

# Tests path separator match below top of path
new_ec_test(nested_path_separator path_separator.in nested/path/separator "^[ \t\n\r]*$")
# Tests path separator match top of path only
new_ec_test(top_level_path_separator path_separator.in top/of/path "^key2=value2[ \t\n\r]*$")

They test these two conditions...

[path/separator]
key1=value1
[/top/of/path]
key2=value2

At this point I'm assuming the first test is incorrect...or else I am completely not understanding how to implement them.


My assumption is that path/separator would match any of the following (especially since the comment for the first test says "Tests path separator match below top of path":

  • <root_dir>/path/separator
  • <root_dir>/a/path/separator
  • <root_dir>/b/c/path/separator
  • <root_dir>/nested/path/separator

However the test is expecting it to not have key1=value1


My other assumption is that /top/of/path would only match:

  • <root_dir>/top/of/path

And not match any others such as:

  • <root_dir>/a/top/of/path
  • <root_dir>/b/c/top/of/path

Which seems to be correct according to the test.

@xuhdev
Copy link
Member

xuhdev commented Apr 15, 2020

The first test passed in nested/path/separator and it should not match <root_dir>/path/separator. I don't see any issue with it. Am I missing something?

@dail8859
Copy link
Member Author

I'm still a bit confused...could you describe the difference between these two in simple English? I will take a guess to give you an idea what I am looking for...these are apparently wrong so any clarification is appreciated.

  • path/separator - matches any file called separator that is any folder called path
  • /top/of/path - matches the exact path /top/of/path under the current working directory

@xuhdev
Copy link
Member

xuhdev commented Apr 16, 2020

The first one says nested/path/separator should not match path/separator, and the second one says top/of/path should match /top/of/path

@dail8859
Copy link
Member Author

So does a pattern starting with / have any special meaning?

@xuhdev
Copy link
Member

xuhdev commented Apr 16, 2020

It means the same path as the .editorconfig, because we said on editorconfig.org that it's meant to be the same as gitignore. I believed that we probably have probably missed it in the spec.

@dail8859
Copy link
Member Author

It means the same path as the .editorconfig, because we said on editorconfig.org that it's meant to be the same as gitignore. I believed that we probably have probably missed it in the spec.

The specification and the main webpage state the EditorConfig glob patters are "similar to the format accepted by gitignore" so I've never been sure which parts are similar and which parts are not (plus that link doesn't document anything about how braces are handled in various conditions, etc).

I think I have enough of a grasp of it for now I hope

Thank you for all the time and explanation 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants