diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index ddf6150a5..2a6726abf 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -40,6 +40,7 @@ import Data.Term import Language.Haskell.HsColour import Language.Haskell.HsColour.Colourise import Language.JSON.Translate +import Language.Ruby.Translate import Matching.Core import Parsing.Parser import Prologue hiding (weaken) @@ -156,6 +157,16 @@ prettyShow = putStrLn . hscolour TTY defaultColourPrefs False False "" False . p -- Code rewriting experiments -- +testRubyFile = do + let path = "test/fixtures/ruby/reprinting/function.rb" + src <- blobSource <$> readBlobFromPath (File path Language.Ruby) + tree <- parseFile miniRubyParser path + pure (src, tree) + +testRubyPipeline = do + (src, tree) <- testRubyFile + printToTerm $ runReprinter src translatingRuby (mark Refactored tree) + testJSONFile = do let path = "test/fixtures/javascript/reprinting/map.json" src <- blobSource <$> readBlobFromPath (File path Language.JSON) diff --git a/test/fixtures/ruby/reprinting/function.rb b/test/fixtures/ruby/reprinting/function.rb new file mode 100644 index 000000000..6d3cb3be5 --- /dev/null +++ b/test/fixtures/ruby/reprinting/function.rb @@ -0,0 +1,4 @@ +def foo(x) + x + 5 +end