2018-03-14 02:19:26 +03:00
|
|
|
{-# 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
|
2018-03-15 22:29:08 +03:00
|
|
|
it "require_relative method" $ do
|
|
|
|
env <- evaluate "main.rb"
|
2018-03-14 02:19:26 +03:00
|
|
|
let expectedEnv = Environment $ fromList [ (qualifiedName ["foo"], addr 0) ]
|
2018-03-15 22:29:08 +03:00
|
|
|
env `shouldBe` expectedEnv
|
2018-03-14 02:19:26 +03:00
|
|
|
|
|
|
|
where
|
|
|
|
addr = Address . Precise
|
|
|
|
fixtures = "test/fixtures/ruby/analysis/"
|
2018-03-15 22:29:08 +03:00
|
|
|
evaluate entry = snd . fst . fst . fst <$>
|
2018-03-14 02:19:26 +03:00
|
|
|
evaluateFiles @RubyValue rubyParser
|
|
|
|
[ fixtures <> entry
|
|
|
|
, fixtures <> "foo.rb"
|
|
|
|
]
|