Skip to content

Commit 7526ea2

Browse files
committed
improve string tests
1 parent 28288ba commit 7526ea2

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

test/stringTests.js

+18-9
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,27 @@ describe('Test strings', function() {
8989
it('...', function() {
9090
var ast = parser.parseEval('return "Class.create(\'$package$className\',{";');
9191
});
92-
it('heredoc ...', function() {
92+
it('test encapsed elements', function() {
9393
var ast = parser.parseEval([
9494
'$code = <<<\t EOFX',
95-
'',
96-
'/*{$this->docStar}',
97-
' * Constructor.',
98-
' */',
99-
'public function __construct()',
100-
'${$targetDirs}',
101-
'$test',
95+
'{$this->docStar}',
96+
'${$foo}',
97+
'${targetDirs[1]}',
98+
'$test[1]',
99+
'$test->foo',
102100
'EOFX;'
103-
].join('\r\n'));
101+
].join('\r'), {
102+
parser: {
103+
debug: false
104+
}
105+
});
106+
var expr = ast.children[0].right.value;
107+
expr[0].kind.should.be.exactly('propertylookup');
108+
expr[2].kind.should.be.exactly('variable');
109+
expr[4].kind.should.be.exactly('variable');
110+
expr[6].kind.should.be.exactly('offsetlookup');
111+
expr[8].kind.should.be.exactly('propertylookup');
112+
// @todo : improve assertions
104113
});
105114
it('test nowdoc label and contents', function() {
106115
var ast = parser.parseEval([

0 commit comments

Comments
 (0)