-
-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #615 from motdotla/backtick-support
Add support for backticks
- Loading branch information
Showing
9 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,23 +5,34 @@ AFTER_LINE=after_line | |
EMPTY= | ||
EMPTY_SINGLE_QUOTES='' | ||
EMPTY_DOUBLE_QUOTES="" | ||
EMPTY_BACKTICKS=`` | ||
SINGLE_QUOTES='single_quotes' | ||
SINGLE_QUOTES_SPACED=' single quotes ' | ||
DOUBLE_QUOTES="double_quotes" | ||
DOUBLE_QUOTES_SPACED=" double quotes " | ||
DOUBLE_QUOTES_INSIDE_SINGLE='double "quotes" work inside single quotes' | ||
SINGLE_QUOTES_INSIDE_DOUBLE="single 'quotes' work inside double quotes" | ||
BACKTICKS_INSIDE_SINGLE='`backticks` work inside single quotes' | ||
BACKTICKS_INSIDE_DOUBLE="`backticks` work inside double quotes" | ||
BACKTICKS=`backticks` | ||
BACKTICKS_SPACED=` backticks ` | ||
DOUBLE_QUOTES_INSIDE_BACKTICKS=`double "quotes" work inside backticks` | ||
SINGLE_QUOTES_INSIDE_BACKTICKS=`single 'quotes' work inside backticks` | ||
DOUBLE_AND_SINGLE_QUOTES_INSIDE_BACKTICKS=`double "quotes" and single 'quotes' work inside backticks` | ||
EXPAND_NEWLINES="expand\nnew\nlines" | ||
DONT_EXPAND_UNQUOTED=dontexpand\nnewlines | ||
DONT_EXPAND_SQUOTED='dontexpand\nnewlines' | ||
DONT_EXPAND_SQUOTED='dontexpand\nnewlines' | ||
# COMMENTS=work | ||
INLINE_COMMENTS=inline comments # work #very #well | ||
INLINE_COMMENTS_SINGLE_QUOTES='inline comments outside of #singlequotes' # work | ||
INLINE_COMMENTS_DOUBLE_QUOTES="inline comments outside of #doublequotes" # work | ||
INLINE_COMMENTS_BACKTICKS=`inline comments outside of #backticks` # work | ||
INLINE_COMMENTS_SPACE=inline comments start with a#space | ||
EQUAL_SIGNS=equals== | ||
RETAIN_INNER_QUOTES={"foo": "bar"} | ||
RETAIN_INNER_QUOTES_AS_STRING='{"foo": "bar"}' | ||
RETAIN_INNER_QUOTES_AS_BACKTICKS=`{"foo": "bar's"}` | ||
TRIM_SPACE_FROM_UNQUOTED= some spaced out string | ||
USERNAME=[email protected] | ||
SPACED_KEY = parsed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,9 @@ IS | |
A | ||
MULTILINE | ||
STRING' | ||
|
||
MULTI_BACKTICKED=`THIS | ||
IS | ||
A | ||
"MULTILINE'S" | ||
STRING` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ t.equal(parsed.EMPTY_SINGLE_QUOTES, '', 'defaults empty values to empty string') | |
|
||
t.equal(parsed.EMPTY_DOUBLE_QUOTES, '', 'defaults empty values to empty string') | ||
|
||
t.equal(parsed.EMPTY_BACKTICKS, '', 'defaults empty values to empty string') | ||
|
||
t.equal(parsed.SINGLE_QUOTES, 'single_quotes', 'escapes single quoted values') | ||
|
||
t.equal(parsed.SINGLE_QUOTES_SPACED, ' single quotes ', 'respects surrounding spaces in single quotes') | ||
|
@@ -29,6 +31,20 @@ t.equal(parsed.DOUBLE_QUOTES_INSIDE_SINGLE, 'double "quotes" work inside single | |
|
||
t.equal(parsed.SINGLE_QUOTES_INSIDE_DOUBLE, "single 'quotes' work inside double quotes", 'respects single quotes inside double quotes') | ||
|
||
t.equal(parsed.BACKTICKS_INSIDE_SINGLE, '`backticks` work inside single quotes', 'respects backticks inside single quotes') | ||
|
||
t.equal(parsed.BACKTICKS_INSIDE_DOUBLE, '`backticks` work inside double quotes', 'respects backticks inside double quotes') | ||
|
||
t.equal(parsed.BACKTICKS, 'backticks') | ||
|
||
t.equal(parsed.BACKTICKS_SPACED, ' backticks ') | ||
|
||
t.equal(parsed.DOUBLE_QUOTES_INSIDE_BACKTICKS, 'double "quotes" work inside backticks', 'respects double quotes inside backticks') | ||
|
||
t.equal(parsed.SINGLE_QUOTES_INSIDE_BACKTICKS, "single 'quotes' work inside backticks", 'respects single quotes inside backticks') | ||
|
||
t.equal(parsed.DOUBLE_AND_SINGLE_QUOTES_INSIDE_BACKTICKS, "double \"quotes\" and single 'quotes' work inside backticks", 'respects single quotes inside backticks') | ||
|
||
t.equal(parsed.EXPAND_NEWLINES, 'expand\nnew\nlines', 'expands newlines but only if double quoted') | ||
|
||
t.equal(parsed.DONT_EXPAND_UNQUOTED, 'dontexpand\\nnewlines', 'expands newlines but only if double quoted') | ||
|
@@ -43,6 +59,8 @@ t.equal(parsed.INLINE_COMMENTS_SINGLE_QUOTES, 'inline comments outside of #singl | |
|
||
t.equal(parsed.INLINE_COMMENTS_DOUBLE_QUOTES, 'inline comments outside of #doublequotes', 'ignores inline comments and respects # character inside of double quotes') | ||
|
||
t.equal(parsed.INLINE_COMMENTS_BACKTICKS, 'inline comments outside of #backticks', 'ignores inline comments and respects # character inside of backticks') | ||
|
||
t.equal(parsed.INLINE_COMMENTS_SPACE, 'inline comments start with a', 'treats # character as start of comment') | ||
|
||
t.equal(parsed.EQUAL_SIGNS, 'equals==', 'respects equals signs in values') | ||
|
@@ -55,6 +73,8 @@ t.equal(parsed.RETAIN_INNER_QUOTES, '{"foo": "bar"}', 'retains inner quotes') | |
|
||
t.equal(parsed.RETAIN_INNER_QUOTES_AS_STRING, '{"foo": "bar"}', 'retains inner quotes') | ||
|
||
t.equal(parsed.RETAIN_INNER_QUOTES_AS_BACKTICKS, '{"foo": "bar\'s"}', 'retains inner quotes') | ||
|
||
t.equal(parsed.TRIM_SPACE_FROM_UNQUOTED, 'some spaced out string', 'retains spaces in string') | ||
|
||
t.equal(parsed.USERNAME, '[email protected]', 'parses email addresses completely') | ||
|