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:
parent
038af3ccb2
commit
69e2eda8db
@ -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
4
test/fixtures/php/analysis/bar.php
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
function bar() {
|
||||
return 1;
|
||||
}
|
2
test/fixtures/php/analysis/main.php
vendored
2
test/fixtures/php/analysis/main.php
vendored
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
include 'foo.php';
|
||||
require 'bar.php';
|
||||
|
||||
foo();
|
||||
bar();
|
||||
|
6
test/fixtures/php/analysis/main_once.php
vendored
Normal file
6
test/fixtures/php/analysis/main_once.php
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
include_once 'foo.php';
|
||||
require_once 'bar.php';
|
||||
|
||||
foo();
|
||||
bar();
|
Loading…
Reference in New Issue
Block a user