mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
remove otiose boolean check
This commit is contained in:
parent
1c5ac83791
commit
a1b7eb9d5d
@ -76,21 +76,19 @@ assertJQExpressionSucceeds directive core = do
|
||||
|
||||
assertTranslationSucceeds :: HasCallStack => FilePath -> HUnit.Assertion
|
||||
assertTranslationSucceeds fp = withFrozenCallStack $ do
|
||||
let skipThisTest = "fails" `isInfixOf` fp || "disabled" `isInfixOf` fp
|
||||
unless skipThisTest $ do
|
||||
fileContents <- ByteString.readFile ("semantic-python/test/fixtures" </> fp)
|
||||
let first = ByteString.takeWhile (/= '\n') fileContents
|
||||
directive <- case Directive.parseDirective first of
|
||||
Right dir -> pure dir
|
||||
Left err -> HUnit.assertFailure ("Directive parsing error: " <> err)
|
||||
fileContents <- ByteString.readFile ("semantic-python/test/fixtures" </> fp)
|
||||
let first = ByteString.takeWhile (/= '\n') fileContents
|
||||
directive <- case Directive.parseDirective first of
|
||||
Right dir -> pure dir
|
||||
Left err -> HUnit.assertFailure ("Directive parsing error: " <> err)
|
||||
|
||||
result <- TS.parseByteString TSP.tree_sitter_python fileContents
|
||||
let coreResult = fmap (Py.compile @TSP.Module @_ @(Term (Ann :+: Core))) result
|
||||
case coreResult of
|
||||
Right (Left _) | directive == Directive.Fails -> pure ()
|
||||
Right (Right item) -> assertJQExpressionSucceeds directive item
|
||||
Right (Left err) -> HUnit.assertFailure ("Compilation failed: " <> err)
|
||||
Left err -> HUnit.assertFailure ("Parsing failed: " <> err)
|
||||
result <- TS.parseByteString TSP.tree_sitter_python fileContents
|
||||
let coreResult = fmap (Py.compile @TSP.Module @_ @(Term (Ann :+: Core))) result
|
||||
case coreResult of
|
||||
Right (Left _) | directive == Directive.Fails -> pure ()
|
||||
Right (Right item) -> assertJQExpressionSucceeds directive item
|
||||
Right (Left err) -> HUnit.assertFailure ("Compilation failed: " <> err)
|
||||
Left err -> HUnit.assertFailure ("Parsing failed: " <> err)
|
||||
|
||||
|
||||
milestoneFixtures :: Tasty.TestTree
|
||||
|
Loading…
Reference in New Issue
Block a user