Skip to content

Commit bb6f514

Browse files
committed
Add test for quoted key name/val
1 parent 2b9dede commit bb6f514

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
server_name localhost 127.0.0.1;
4646
root /srv/http; # And also this one
4747
mykey "myvalue; #notme myothervalue";
48+
"quoted_key" "quoted_value";
4849
# This one too
4950
index index.php;
5051
if (!-e $request_filename)
@@ -128,9 +129,10 @@ def test_key_parse(self):
128129

129130
def test_key_parse_complex(self):
130131
data = nginx.loads(TESTBLOCK_CASE_2)
131-
self.assertEqual(len(data.server.keys), 5)
132+
self.assertEqual(len(data.server.keys), 6)
132133
firstKey = data.server.keys[0]
133134
thirdKey = data.server.keys[3]
135+
fourthKey = data.server.keys[4]
134136
self.assertEqual(firstKey.name, 'listen')
135137
self.assertEqual(firstKey.value, '80')
136138
self.assertEqual(thirdKey.name, 'mykey')
@@ -139,6 +141,8 @@ def test_key_parse_complex(self):
139141
data.server.locations[-1].keys[0].value,
140142
"301 $scheme://$host:$server_port${request_uri}bitbucket/"
141143
)
144+
self.assertEqual(fourthKey.name, '"quoted_key"')
145+
self.assertEqual(fourthKey.value, '"quoted_value"')
142146

143147
def test_location_parse(self):
144148
data = nginx.loads(TESTBLOCK_CASE_1)

0 commit comments

Comments
 (0)