Skip to content

Commit b8e3162

Browse files
authored
Amended tests (#44)
1 parent 52fec2f commit b8e3162

File tree

10 files changed

+316
-9
lines changed

10 files changed

+316
-9
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ cache:
3737

3838
before_install:
3939
- phpenv config-rm xdebug.ini || true
40-
- travis_retry gem install coveralls-lcov
4140
- ulimit -c unlimited -S
4241

4342
install:

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88
### Removed
9-
- PHP 5.x no longer supported. PHP 5 users should use previous releases
9+
- PHP 5.x no longer supported. PHP 5.x users should use previous releases
1010

1111
## [1.1.3] - 2018-11-06
1212
### Changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
The Zephir Parser delivered as a C extension for the PHP language.
99

10-
Supported PHP versions: **7.0**, **7.1**, **7.2**.
10+
Supported PHP versions: **7.0**, **7.1**, **7.2**, **7.3** and **7.4** (nightly).
1111

1212
**NOTE:** The [`development`][:dev-branch:]
1313
branch will always contain the latest **unstable** version. If you wish to
@@ -22,7 +22,7 @@ Prerequisite packages are:
2222

2323
* OS: Linux || Solaris || FreeBSD || macOS || Windows
2424
* Compiler: `g++` >= 4.4 || `clang++` >= 3.x || `vc++` >= 11
25-
* [`re2c`](http://re2c.org/) >= 0.13.6
25+
* [`re2c`][:re2c:] >= 0.13.6
2626

2727
To build extension from the source you will need the PHP development headers.
2828
If PHP was manually installed, these should be available by default.
@@ -48,9 +48,9 @@ extension from sources.
4848

4949
For Linux/Unix-based based systems you'll need also:
5050

51-
* [GNU make](https://www.gnu.org/software/make/) 3.81 or later
52-
* [autoconf](https://www.gnu.org/software/autoconf/autoconf.html) 2.31 or later
53-
* [automake](https://www.gnu.org/software/automake/) 1.14 or later
51+
* [GNU make][:gnu-make:] 3.81 or later
52+
* [autoconf][:gnu-autoconf:] 2.31 or later
53+
* [automake][:gnu-automake:] 1.14 or later
5454

5555
#### Ubuntu
5656

@@ -131,3 +131,7 @@ See the [LICENSE][:ext-license:] file for more information.
131131
[:dev-branch:]:https://github.com/phalcon/php-zephir-parser/tree/development
132132
[:branches:]: https://github.com/phalcon/php-zephir-parser/branches
133133
[:tags:]: https://github.com/phalcon/php-zephir-parser/tags
134+
[:re2c:]: http://re2c.org
135+
[:gnu-make:]: https://www.gnu.org/software/make
136+
[:gnu-autoconf:]: https://www.gnu.org/software/autoconf/autoconf.html
137+
[:gnu-automake:]: https://www.gnu.org/software/automake

parser/scanner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Generated by re2c 1.0.3 */
1+
/* Generated by re2c 1.1.1 */
22
#line 1 "parser/scanner.re"
33

44
/*

parser/xx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#ifndef PHP_ZEPHIR_XX_H
1212
#define PHP_ZEPHIR_XX_H
1313

14+
#include <Zend/zend_types.h>
15+
1416
/* List of tokens and their names */
1517
typedef struct _xx_token_names {
1618
unsigned int code;

tests/errors/bug30.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
--TEST--
2-
Syntax error on statement w/o assignment
2+
Syntax error when use unicode
33
--SKIPIF--
44
<?php include(__DIR__ . '/../skipif.inc'); ?>
55
--FILE--

tests/namespaces/001.phpt

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
--TEST--
2+
Using imports
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$code =<<<ZEP
9+
namespace Example;
10+
11+
use Foo;
12+
use Bar;
13+
ZEP;
14+
15+
var_dump(zephir_parse_file($code, '(eval code)'));
16+
--EXPECT--
17+
array(3) {
18+
[0]=>
19+
array(5) {
20+
["type"]=>
21+
string(9) "namespace"
22+
["name"]=>
23+
string(7) "Example"
24+
["file"]=>
25+
string(11) "(eval code)"
26+
["line"]=>
27+
int(3)
28+
["char"]=>
29+
int(3)
30+
}
31+
[1]=>
32+
array(5) {
33+
["type"]=>
34+
string(3) "use"
35+
["aliases"]=>
36+
array(1) {
37+
[0]=>
38+
array(4) {
39+
["name"]=>
40+
string(3) "Foo"
41+
["file"]=>
42+
string(11) "(eval code)"
43+
["line"]=>
44+
int(3)
45+
["char"]=>
46+
int(8)
47+
}
48+
}
49+
["file"]=>
50+
string(11) "(eval code)"
51+
["line"]=>
52+
int(4)
53+
["char"]=>
54+
int(3)
55+
}
56+
[2]=>
57+
array(5) {
58+
["type"]=>
59+
string(3) "use"
60+
["aliases"]=>
61+
array(1) {
62+
[0]=>
63+
array(4) {
64+
["name"]=>
65+
string(3) "Bar"
66+
["file"]=>
67+
string(11) "(eval code)"
68+
["line"]=>
69+
int(4)
70+
["char"]=>
71+
int(8)
72+
}
73+
}
74+
["file"]=>
75+
string(11) "(eval code)"
76+
["line"]=>
77+
int(4)
78+
["char"]=>
79+
int(8)
80+
}
81+
}

tests/namespaces/002.phpt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
--TEST--
2+
Using imports and aliases
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$code =<<<ZEP
9+
namespace Example;
10+
11+
use Foo as Baz;
12+
use Bar as Buz;
13+
ZEP;
14+
15+
var_dump(zephir_parse_file($code, '(eval code)'));
16+
--EXPECT--
17+
array(3) {
18+
[0]=>
19+
array(5) {
20+
["type"]=>
21+
string(9) "namespace"
22+
["name"]=>
23+
string(7) "Example"
24+
["file"]=>
25+
string(11) "(eval code)"
26+
["line"]=>
27+
int(3)
28+
["char"]=>
29+
int(3)
30+
}
31+
[1]=>
32+
array(5) {
33+
["type"]=>
34+
string(3) "use"
35+
["aliases"]=>
36+
array(1) {
37+
[0]=>
38+
array(5) {
39+
["name"]=>
40+
string(3) "Foo"
41+
["alias"]=>
42+
string(3) "Baz"
43+
["file"]=>
44+
string(11) "(eval code)"
45+
["line"]=>
46+
int(3)
47+
["char"]=>
48+
int(15)
49+
}
50+
}
51+
["file"]=>
52+
string(11) "(eval code)"
53+
["line"]=>
54+
int(4)
55+
["char"]=>
56+
int(3)
57+
}
58+
[2]=>
59+
array(5) {
60+
["type"]=>
61+
string(3) "use"
62+
["aliases"]=>
63+
array(1) {
64+
[0]=>
65+
array(5) {
66+
["name"]=>
67+
string(3) "Bar"
68+
["alias"]=>
69+
string(3) "Buz"
70+
["file"]=>
71+
string(11) "(eval code)"
72+
["line"]=>
73+
int(4)
74+
["char"]=>
75+
int(15)
76+
}
77+
}
78+
["file"]=>
79+
string(11) "(eval code)"
80+
["line"]=>
81+
int(4)
82+
["char"]=>
83+
int(15)
84+
}
85+
}

tests/namespaces/003.phpt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
--TEST--
2+
Using imports and comma
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$code =<<<ZEP
9+
namespace Example;
10+
11+
use Foo, Bar;
12+
ZEP;
13+
14+
var_dump(zephir_parse_file($code, '(eval code)'));
15+
--EXPECT--
16+
array(2) {
17+
[0]=>
18+
array(5) {
19+
["type"]=>
20+
string(9) "namespace"
21+
["name"]=>
22+
string(7) "Example"
23+
["file"]=>
24+
string(11) "(eval code)"
25+
["line"]=>
26+
int(3)
27+
["char"]=>
28+
int(3)
29+
}
30+
[1]=>
31+
array(5) {
32+
["type"]=>
33+
string(3) "use"
34+
["aliases"]=>
35+
array(2) {
36+
[0]=>
37+
array(4) {
38+
["name"]=>
39+
string(3) "Foo"
40+
["file"]=>
41+
string(11) "(eval code)"
42+
["line"]=>
43+
int(3)
44+
["char"]=>
45+
int(8)
46+
}
47+
[1]=>
48+
array(4) {
49+
["name"]=>
50+
string(3) "Bar"
51+
["file"]=>
52+
string(11) "(eval code)"
53+
["line"]=>
54+
int(3)
55+
["char"]=>
56+
int(13)
57+
}
58+
}
59+
["file"]=>
60+
string(11) "(eval code)"
61+
["line"]=>
62+
int(3)
63+
["char"]=>
64+
int(13)
65+
}
66+
}

tests/namespaces/004.phpt

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
--TEST--
2+
Using imports, comma and aliases
3+
--SKIPIF--
4+
<?php include(__DIR__ . '/../skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
8+
$code =<<<ZEP
9+
namespace Example;
10+
11+
use Foo as Baz, Bar as Buz;
12+
ZEP;
13+
14+
var_dump(zephir_parse_file($code, '(eval code)'));
15+
--EXPECT--
16+
array(2) {
17+
[0]=>
18+
array(5) {
19+
["type"]=>
20+
string(9) "namespace"
21+
["name"]=>
22+
string(7) "Example"
23+
["file"]=>
24+
string(11) "(eval code)"
25+
["line"]=>
26+
int(3)
27+
["char"]=>
28+
int(3)
29+
}
30+
[1]=>
31+
array(5) {
32+
["type"]=>
33+
string(3) "use"
34+
["aliases"]=>
35+
array(2) {
36+
[0]=>
37+
array(5) {
38+
["name"]=>
39+
string(3) "Foo"
40+
["alias"]=>
41+
string(3) "Baz"
42+
["file"]=>
43+
string(11) "(eval code)"
44+
["line"]=>
45+
int(3)
46+
["char"]=>
47+
int(15)
48+
}
49+
[1]=>
50+
array(5) {
51+
["name"]=>
52+
string(3) "Bar"
53+
["alias"]=>
54+
string(3) "Buz"
55+
["file"]=>
56+
string(11) "(eval code)"
57+
["line"]=>
58+
int(3)
59+
["char"]=>
60+
int(27)
61+
}
62+
}
63+
["file"]=>
64+
string(11) "(eval code)"
65+
["line"]=>
66+
int(3)
67+
["char"]=>
68+
int(27)
69+
}
70+
}

0 commit comments

Comments
 (0)