1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00
This commit is contained in:
Timothy Clem 2018-03-13 16:19:26 -07:00
parent 9e118aac51
commit 1e276dddef
3 changed files with 32 additions and 0 deletions

View File

@ -207,6 +207,7 @@ test-suite test
other-modules: Assigning.Assignment.Spec other-modules: Assigning.Assignment.Spec
, Analysis.Go.Spec , Analysis.Go.Spec
, Analysis.Python.Spec , Analysis.Python.Spec
, Analysis.Ruby.Spec
, Analysis.TypeScript.Spec , Analysis.TypeScript.Spec
, Data.Diff.Spec , Data.Diff.Spec
, Data.Functor.Classes.Generic.Spec , Data.Functor.Classes.Generic.Spec

View File

@ -0,0 +1,29 @@
{-# LANGUAGE TypeApplications #-}
module Analysis.Ruby.Spec (spec) where
import Data.Abstract.Value
import Data.Map
import SpecHelpers
spec :: Spec
spec = parallel $ do
describe "evalutes Ruby" $ do
it "require_relatives" $ do
res <- evaluate "main.rb"
let expectedEnv = Environment $ fromList [ (qualifiedName ["foo"], addr 0) ]
assertEnvironment res expectedEnv
where
assertEnvironment result expectedEnv = case result of
Left e -> expectationFailure ("Evaluating expected to succeed, but failed with: " <> e)
Right res -> let Just (Interface _ env) = prjValue @(Interface Precise) res in env `shouldBe` expectedEnv
addr = Address . Precise
fixtures = "test/fixtures/ruby/analysis/"
evaluate entry = fst . fst . fst . fst <$>
evaluateFiles @RubyValue rubyParser
[ fixtures <> entry
, fixtures <> "foo.rb"
]

View File

@ -2,6 +2,7 @@ module Main where
import qualified Analysis.Go.Spec import qualified Analysis.Go.Spec
import qualified Analysis.Python.Spec import qualified Analysis.Python.Spec
import qualified Analysis.Ruby.Spec
import qualified Analysis.TypeScript.Spec import qualified Analysis.TypeScript.Spec
import qualified Assigning.Assignment.Spec import qualified Assigning.Assignment.Spec
import qualified Data.Diff.Spec import qualified Data.Diff.Spec
@ -27,6 +28,7 @@ main = hspec $ do
parallel $ do parallel $ do
describe "Analysis.Go" Analysis.Go.Spec.spec describe "Analysis.Go" Analysis.Go.Spec.spec
describe "Analysis.Python" Analysis.Python.Spec.spec describe "Analysis.Python" Analysis.Python.Spec.spec
describe "Analysis.Ruby" Analysis.Ruby.Spec.spec
describe "Analysis.TypeScript" Analysis.TypeScript.Spec.spec describe "Analysis.TypeScript" Analysis.TypeScript.Spec.spec
describe "Assigning.Assignment" Assigning.Assignment.Spec.spec describe "Assigning.Assignment" Assigning.Assignment.Spec.spec
describe "Data.Diff" Data.Diff.Spec.spec describe "Data.Diff" Data.Diff.Spec.spec