Skip to content

Commit ca6a3fc

Browse files
committed
Added testcases, updated readme and changelog
1 parent 2645dbb commit ca6a3fc

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ All Notable changes to `Env` will be documented in this file
44

55
## 1.1.0 - 2016-01-05
66
### Added
7-
- Support for parameter expansions: (default value)[http://wiki.bash-hackers.org/syntax/pe#use_a_default_value] and (assign default value)[http://wiki.bash-hackers.org/syntax/pe#assign_a_default_value]
7+
- Support for parameter expansions: [default value](http://wiki.bash-hackers.org/syntax/pe#use_a_default_value) and [assign default value](http://wiki.bash-hackers.org/syntax/pe#assign_a_default_value)
8+
- Support for php `5.3` and `hhvm`
89

910
### Altered
1011
- Updated README
12+
- Test cases
1113

1214
## 1.0.2 - 2016-01-03
1315
### Altered

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ TEST6 = ${TEST7:-bar}
214214
TEST8 = ${TEST9-bar}
215215
```
216216

217-
The default value parameter expansion syntax is `:-`, the explanation on the (bash-hackers wiki)[http://wiki.bash-hackers.org/syntax/pe#use_a_default_value] for this is:
217+
The default value parameter expansion syntax is `:-`, the explanation on the [bash-hackers wiki](http://wiki.bash-hackers.org/syntax/pe#use_a_default_value) for this is:
218218
> SYNTAX:
219219
>
220220
>`${PARAMETER:-WORD}`
@@ -238,7 +238,7 @@ TEST7 = ${TEST6:-bar} # TEST5 is set and empty so the value of TEST7 = bar
238238
239239
```
240240

241-
The assign default value parameter expansion is `:=`, the explanation on the (bash-hackers wiki)[http://wiki.bash-hackers.org/syntax/pe#assign_a_default_value] for this is:
241+
The assign default value parameter expansion is `:=`, the explanation on the [bash-hackers wiki](http://wiki.bash-hackers.org/syntax/pe#assign_a_default_value) for this is:
242242
> SYNTAX:
243243
>
244244
>`${PARAMETER:=WORD}`
@@ -358,6 +358,13 @@ TEST56=${TEST55-foo}
358358
TEST57=${TEST58:=""}
359359
TEST59=${TEST60:=null} # TEST59 = null TEST60 = null -- both `null` types
360360
TEST61=${TEST62:=true} # TEST61 = true TEST62 = true -- both `bool` types
361+
362+
# Comments
363+
TEST62 = hello # comment
364+
TEST63 = "hello # comment"
365+
TEST64 = "hello" #comment
366+
TEST66 = #comment
367+
TEST67 = "#comment"
361368
```
362369

363370
The result from this library and the expected result of the above is:
@@ -425,6 +432,10 @@ array(
425432
'TEST59' => null,
426433
'TEST62' => true,
427434
'TEST61' => true,
435+
'TEST63' => 'hello # comment',
436+
'TEST64' => 'hello',
437+
'TEST66' => null,
438+
'TEST67' => '#comment',
428439
);
429440
```
430441
## Other library comparisons

tests/EnvTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ public function testFinalCase()
249249
'TEST59' => null,
250250
'TEST62' => true,
251251
'TEST61' => true,
252+
'TEST63' => 'hello # comment',
253+
'TEST64' => 'hello',
254+
'TEST66' => null,
255+
'TEST67' => '#comment',
252256
);
253257

254258
$env = Env::Parse(__DIR__.'/mocks/all_testcase.env');

tests/mocks/all_testcase.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,10 @@ TEST56=${TEST55-foo}
8585
TEST57=${TEST58:=""}
8686
TEST59=${TEST60:=null}
8787
TEST61=${TEST62:=true}
88+
89+
# Comments
90+
TEST62 = hello # comment
91+
TEST63 = "hello # comment"
92+
TEST64 = "hello" #comment
93+
TEST66 = #comment
94+
TEST67 = "#comment"

0 commit comments

Comments
 (0)