on master help sign in
feat: add syntax sample for dotEnv files
commitc71c8980cf4a7a917d9fb1712985d3abd48ef54b authorZachary J. Rollyson <me@zjr.io> dateSat 17 Oct 2020, 11:19 (6 years ago) parent6bf7b79
3 files changed+137
tests/syntax-tests/highlighted/DotENV/.env+57 tests/syntax-tests/source/DotENV/.env+57 tests/syntax-tests/source/DotENV/LICENSE.md+23
tests/syntax-tests/highlighted/DotENV/.envnew file+57
@@ -0,0 +1,57 @@
1+# Keyword
2+export TEST_KEYWORD="bar"
3+export TEST_KEYWORD=12345
4+export TEST_KEYWORD=TRUE
5+
6+# Variable
7+TEST_VARIABLE="Hello"
8+
9+# String interpolation
10+TEST_INTERPOLATION_VARIABLE="$VAR1 test test$VAR2test test"
11+TEST_INTERPOLATION_SYNTAX_ONE="test test{$NVAR1}test{$NVAR2}test test"
12+TEST_INTERPOLATION_SYNTAX_TWO="test test${NVAR1}test${NVAR2}test test"
13+TEST_INTERPOLATION_SYNTAX_ALL="test$VAR1test test {VAR2}test test${VAR3}test"
14+
15+# Unquoted
16+TEST_UNQUOTED=bar
17+TEST_UNQUOTED_NO_VALUE=
18+
19+# White spaced
20+TEST_WHITE_SPACE =
21+TEST_WHITE_SPACE_STRING = "Hello"
22+TEST_WHITE_SPACE_UNQUOTED = bar
23+TEST_WHITE_SPACE_UNQUOTED_BOOL = false
24+TEST_WHITE_SPACE_UNQUOTED_NUM = 20
25+
26+# language constants
27+TEST_TRUE=true
28+TEST_FALSE=false
29+TEST_NULL=null
30+TEST_TRUE_CAPITAL=TRUE
31+TEST_FALSE_CAPITAL=FALSE
32+TEST_NULL_CAPITAL=NULL
33+
34+# Numerical values
35+TEST_NUM_DECIMAL=54
36+TEST_NUM_FLOAT=5.3
37+TEST_NUM=1e10
38+TEST_NUM_NEGATIVE=-42
39+TEST_NUM_OCTAL=057
40+TEST_NUM_HEX=0x1A
41+
42+# Comments
43+#TEST_ONE=foobar
44+# TEST_TWO='foobar'
45+# TEST_THREE="foobar" # a comment on a commented row
46+TEST_FOUR="test test test" # this is a comment
47+TEST_FIVE="comment symbol # inside string" # this is a comment
48+TEST_SIX="comment symbol # and quotes \" \' inside quotes" # " this is a comment
49+
50+# Escape sequences
51+TEST_ESCAPE="escaped characters \n \t \r \" \' \$ or maybe a backslash \\..."
52+
53+# Double Quotes
54+TEST_DOUBLE="Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\"
55+
56+# Single Quotes
57+TEST_SINGLE='Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\'
tests/syntax-tests/source/DotENV/.envnew file+57
@@ -0,0 +1,57 @@
1+# Keyword
2+export TEST_KEYWORD="bar"
3+export TEST_KEYWORD=12345
4+export TEST_KEYWORD=TRUE
5+
6+# Variable
7+TEST_VARIABLE="Hello"
8+
9+# String interpolation
10+TEST_INTERPOLATION_VARIABLE="$VAR1 test test$VAR2test test"
11+TEST_INTERPOLATION_SYNTAX_ONE="test test{$NVAR1}test{$NVAR2}test test"
12+TEST_INTERPOLATION_SYNTAX_TWO="test test${NVAR1}test${NVAR2}test test"
13+TEST_INTERPOLATION_SYNTAX_ALL="test$VAR1test test {VAR2}test test${VAR3}test"
14+
15+# Unquoted
16+TEST_UNQUOTED=bar
17+TEST_UNQUOTED_NO_VALUE=
18+
19+# White spaced
20+TEST_WHITE_SPACE =
21+TEST_WHITE_SPACE_STRING = "Hello"
22+TEST_WHITE_SPACE_UNQUOTED = bar
23+TEST_WHITE_SPACE_UNQUOTED_BOOL = false
24+TEST_WHITE_SPACE_UNQUOTED_NUM = 20
25+
26+# language constants
27+TEST_TRUE=true
28+TEST_FALSE=false
29+TEST_NULL=null
30+TEST_TRUE_CAPITAL=TRUE
31+TEST_FALSE_CAPITAL=FALSE
32+TEST_NULL_CAPITAL=NULL
33+
34+# Numerical values
35+TEST_NUM_DECIMAL=54
36+TEST_NUM_FLOAT=5.3
37+TEST_NUM=1e10
38+TEST_NUM_NEGATIVE=-42
39+TEST_NUM_OCTAL=057
40+TEST_NUM_HEX=0x1A
41+
42+# Comments
43+#TEST_ONE=foobar
44+# TEST_TWO='foobar'
45+# TEST_THREE="foobar" # a comment on a commented row
46+TEST_FOUR="test test test" # this is a comment
47+TEST_FIVE="comment symbol # inside string" # this is a comment
48+TEST_SIX="comment symbol # and quotes \" \' inside quotes" # " this is a comment
49+
50+# Escape sequences
51+TEST_ESCAPE="escaped characters \n \t \r \" \' \$ or maybe a backslash \\..."
52+
53+# Double Quotes
54+TEST_DOUBLE="Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\"
55+
56+# Single Quotes
57+TEST_SINGLE='Lorem {$VAR1} ${VAR2} $VAR3 ipsum dolor sit amet\n\r\t\\'
tests/syntax-tests/source/DotENV/LICENSE.mdnew file+23
@@ -0,0 +1,23 @@
1+The `.env.test` file has been added from https://github.com/zaynali53/DotENV under the following license:
2+
3+The MIT License (MIT)
4+
5+Copyright (c) 2016 Zayn Ali
6+
7+Permission is hereby granted, free of charge, to any person obtaining a copy
8+of this software and associated documentation files (the "Software"), to deal
9+in the Software without restriction, including without limitation the rights
10+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+copies of the Software, and to permit persons to whom the Software is
12+furnished to do so, subject to the following conditions:
13+
14+The above copyright notice and this permission notice shall be included in all
15+copies or substantial portions of the Software.
16+
17+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+SOFTWARE.