mirror of
https://github.com/github/semantic.git
synced 2025-01-01 19:55:34 +03:00
Some new re-writing utils for python testing
This commit is contained in:
parent
68a93c6740
commit
2208860f08
@ -21,6 +21,7 @@ import qualified Data.Syntax.Literal as Literal
|
||||
import Data.Term
|
||||
import Language.JSON.PrettyPrint
|
||||
import Language.Ruby.PrettyPrint
|
||||
import Language.Python.PrettyPrint
|
||||
import Matching.Core
|
||||
import Parsing.Parser
|
||||
import Prologue hiding (weaken)
|
||||
@ -28,6 +29,28 @@ import Reprinting.Pipeline
|
||||
import Semantic.IO as IO
|
||||
import Semantic.Task
|
||||
|
||||
testPythonFile = do
|
||||
let path = "test/fixtures/python/reprinting/functions.py"
|
||||
src <- blobSource <$> readBlobFromPath (File path Language.Python)
|
||||
tree <- parseFile miniPythonParser path
|
||||
pure (src, tree)
|
||||
|
||||
testPythonPipeline = do
|
||||
(src, tree) <- testPythonFile
|
||||
printToTerm $ runReprinter src printingPython (mark Refactored tree)
|
||||
|
||||
testPythonPipeline' = do
|
||||
(src, tree) <- testPythonFile
|
||||
pure $ runTokenizing src (mark Refactored tree)
|
||||
|
||||
testPythonPipeline'' = do
|
||||
(src, tree) <- testPythonFile
|
||||
pure $ runContextualizing src (mark Refactored tree)
|
||||
|
||||
testPythonPipeline''' = do
|
||||
(src, tree) <- testPythonFile
|
||||
pure $ runTranslating src printingPython (mark Refactored tree)
|
||||
|
||||
testRubyFile = do
|
||||
let path = "test/fixtures/ruby/reprinting/infix.rb"
|
||||
src <- blobSource <$> readBlobFromPath (File path Language.Ruby)
|
||||
|
Loading…
Reference in New Issue
Block a user