mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-29 04:53:17 +02:00
fix(dotenv): implement secure parsing for .env files and add comprehensive tests
This commit is contained in:
parent
139bc2b5a1
commit
2014363332
10 changed files with 850 additions and 1 deletions
27
plugins/dotenv/tests/compatibility.zunit
Normal file
27
plugins/dotenv/tests/compatibility.zunit
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env zunit
|
||||
|
||||
@setup {
|
||||
unset DOTENV_TEST_VARS DOTENV_SOURCE_VARS 2>/dev/null
|
||||
}
|
||||
|
||||
@teardown {
|
||||
unset DOTENV_TEST_VARS DOTENV_SOURCE_VARS 2>/dev/null
|
||||
}
|
||||
|
||||
@test 'compatibility: dotenvjs fixture matches native source' {
|
||||
local fixture="${testdir:A}/_support/fixtures/dotenvjs.env"
|
||||
|
||||
_parse_dotenv_test "$fixture"
|
||||
_source_with_allexport "$fixture"
|
||||
|
||||
assert "DOTENV_TEST_VARS" var_same_as "DOTENV_SOURCE_VARS"
|
||||
}
|
||||
|
||||
@test 'compatibility: features fixture matches native source' {
|
||||
local fixture="${testdir:A}/_support/fixtures/features.env"
|
||||
|
||||
_parse_dotenv_test "$fixture"
|
||||
_source_with_allexport "$fixture"
|
||||
|
||||
assert "DOTENV_TEST_VARS" var_same_as "DOTENV_SOURCE_VARS"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue