1
1
mirror of https://github.com/github/semantic.git synced 2024-12-29 01:42:43 +03:00

Test the return values

This commit is contained in:
Rob Rix 2018-05-28 15:44:48 -04:00
parent 7b02e3e64f
commit 038d3d07eb

View File

@ -1,5 +1,6 @@
module Analysis.PHP.Spec (spec) where
import Control.Abstract
import Data.Abstract.Environment as Env
import Data.Abstract.Evaluatable (EvalError(..))
import qualified Data.Language as Language
@ -11,12 +12,14 @@ spec :: Spec
spec = parallel $ do
describe "PHP" $ do
it "evaluates include and require" $ do
env <- environment . snd . fst <$> evaluate "main.php"
Env.names env `shouldBe` [ "bar", "foo" ]
((res, state), _) <- evaluate "main.php"
res `shouldBe` Right [unit]
Env.names (environment state) `shouldBe` [ "bar", "foo" ]
it "evaluates include_once and require_once" $ do
env <- environment . snd . fst <$> evaluate "main_once.php"
Env.names env `shouldBe` [ "bar", "foo" ]
((res, state), _) <- evaluate "main_once.php"
res `shouldBe` Right [unit]
Env.names (environment state) `shouldBe` [ "bar", "foo" ]
it "evaluates namespaces" $ do
((_, state), _) <- evaluate "namespaces.php"