1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Couple more tests

This commit is contained in:
Timothy Clem 2018-03-20 16:46:32 -07:00
parent 038af3ccb2
commit 69e2eda8db
4 changed files with 22 additions and 2 deletions

View File

@ -10,9 +10,16 @@ import SpecHelpers
spec :: Spec
spec = parallel $ do
describe "evalutes PHP" $ do
it "include" $ do
it "include and require" $ do
env <- evaluate "main.php"
let expectedEnv = [ (qualifiedName ["foo"], addr 0) ]
let expectedEnv = [ (qualifiedName ["foo"], addr 0)
, (qualifiedName ["bar"], addr 1) ]
env `shouldBe` expectedEnv
it "include_once and require_once" $ do
env <- evaluate "main_once.php"
let expectedEnv = [ (qualifiedName ["foo"], addr 0)
, (qualifiedName ["bar"], addr 1) ]
env `shouldBe` expectedEnv
where
@ -22,4 +29,5 @@ spec = parallel $ do
evaluateFiles phpParser
[ fixtures <> entry
, fixtures <> "foo.php"
, fixtures <> "bar.php"
]

4
test/fixtures/php/analysis/bar.php vendored Normal file
View File

@ -0,0 +1,4 @@
<?php
function bar() {
return 1;
}

View File

@ -1,4 +1,6 @@
<?php
include 'foo.php';
require 'bar.php';
foo();
bar();

View File

@ -0,0 +1,6 @@
<?php
include_once 'foo.php';
require_once 'bar.php';
foo();
bar();