Skip to content

Commit

Permalink
Merge pull request #92 from chimpler/include-fix
Browse files Browse the repository at this point in the history
Include fix
  • Loading branch information
darthbear authored Aug 7, 2016
2 parents abac121 + 99bc5cf commit e9be8c7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyhocon/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def include_config(token):

value_expr = number_expr | true_expr | false_expr | null_expr | string_expr

include_expr = (Keyword("include", caseless=True).suppress() - (
include_expr = (Keyword("include", caseless=True).suppress() + (
quoted_string | (
(Keyword('url') | Keyword('file')) - Literal('(').suppress() - quoted_string - Literal(')').suppress()))) \
.setParseAction(include_config)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,16 @@ def test_include_substitution(self):
assert config['x'] == 42
assert config['y'] == 42

def test_var_with_include_keyword(self):
config = ConfigFactory.parse_string(
"""
include-database=true
""")

assert config == {
'include-database': True
}

def test_substitution_override(self):
config = ConfigFactory.parse_string(
"""
Expand Down

0 comments on commit e9be8c7

Please sign in to comment.