Skip to content

Commit 903e7c0

Browse files
committed
json: test that single-quoted arguments are supported
1 parent 53548df commit 903e7c0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/unit/backend/test_json.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ def test_get_compile_commands(self):
3737
CompileCommand("/tmp/", "/tmp/c.cpp",
3838
["clang", "-DC=1"], "c.o"))
3939

40+
def test_quoted(self):
41+
d_commands = list(self.db.get_compile_commands("/tmp/d.cpp"))
42+
self.assertEqual(len(d_commands), 1)
43+
self.assertEqual(
44+
d_commands[0],
45+
CompileCommand("/tmp/", "/tmp/d.cpp",
46+
["clang", "-I", "a b c", "-I", "d e h"]))
47+
4048
def test_get_all_files(self):
4149
files = list(sorted(self.db.get_all_files()))
4250
self.assertEqual(
@@ -47,4 +55,5 @@ def test_get_all_files(self):
4755
# note: it's debatable whether duplicates should be present
4856
'/tmp/b.cpp',
4957
'/tmp/c.cpp',
58+
'/tmp/d.cpp',
5059
])

tests/unit/backend/test_json_data/compile_commands.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@
2020
"file": "/tmp/c.cpp",
2121
"output": "c.o"
2222
}
23+
,
24+
{
25+
"directory": "/tmp/",
26+
"command": "clang -I 'a b c' -I \"d e h\"",
27+
"file": "/tmp/d.cpp"
28+
}
2329
]

0 commit comments

Comments
 (0)