-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Add known broken tests for import placement #2425
Conversation
ghcide/test/exe/Main.hs
Outdated
@@ -855,7 +855,18 @@ watchedFilesTests = testGroup "watched files" | |||
|
|||
insertImportTests :: TestTree | |||
insertImportTests = testGroup "insert import" | |||
[ checkImport "above comment at top of module" "CommentAtTop.hs" "CommentAtTop.expected.hs" "import Data.Monoid" | |||
[ (`xfail` "known broken") (checkImport "module where keyword lower in file no exports" "WhereKeywordLowerInFileNoExports.hs" "WhereKeywordLowerInFileNoExports.expected.hs" "import Data.Int") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please could you use the expectFailBecause
existing function, if possible with a short insight about why do you think it fail ("known broken" would be fine though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll do that later today.
Many thanks for adding tests, they will help a lot in an eventual resolution //cc @eddiemundo |
93f67d8
to
ea3883a
Compare
{-# OPTIONS_GHC -Wall, | ||
OPTIONS_GHC -Wno-unrecognised-pragmas #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expected version of this test doesn't have the OPTIONS_GHC -Wno-unrecognized-pragmas
line. I think the expected version of the test should have this line unless the test does more than add an import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no you're right, that's updated now.
I see what @nini-faroux was talking about on where to extract the "pre-decl" parser functionality since it's needed in both ghcide CodeAction.hs, and the pragmas plugin. I also need it in the hlint plugin. Of the existing places I think putting it in its own module under ghcide/src/Development/IDE/Spans would be ok since Spans is vaguely related, but stuffing it into CodeAction.hs or in its own module in that folder seems ok too since it has random stuff in there. I think I might extract that functionality into one of those places later today. |
ea3883a
to
3762375
Compare
ghcide/test/exe/Main.hs
Outdated
[ expectFailBecause "'findPositionFromImportsOrModuleDecl' function adds import directly under line with module declaration, not accounting for case when 'where' keyword is placed on lower line" | ||
(checkImport "module where keyword lower in file no exports" "WhereKeywordLowerInFileNoExports.hs" "WhereKeywordLowerInFileNoExports.expected.hs" "import Data.Int") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor formatting thing, maybe the tests could be more legible if they are splitted in several lines, something like
[ expectFailBecause
$ "'findPositionFromImportsOrModuleDecl' function adds import directly under line with module declaration, "
++ "not accounting for case when 'where' keyword is placed on lower line"
(checkImport
"module where keyword lower in file no exports"
"WhereKeywordLowerInFileNoExports.hs"
"WhereKeywordLowerInFileNoExports.expected.hs"
"import Data.Int")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's true, they're updated now
3762375
to
1f0d31f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many thanks again, I hope tests would help in an eventual resolution
Co-authored-by: Javier Neira <[email protected]>
Tests for known issues with import placement.