|
123 | 123 | (should (dap-python--equal actual expected)) |
124 | 124 | (should (dap-python--equal (dap-python--nearest-test expected) "::TestClass::test_foo")))) |
125 | 125 |
|
126 | | -(defun dap-launch-test--delete-string-comments (s) |
| 126 | +(defun dap-launch-test--sanitize-json (s) |
127 | 127 | "Delete all comments in S." |
128 | 128 | (with-temp-buffer |
129 | 129 | (insert s) |
130 | 130 | (goto-char (point-min)) |
131 | 131 |
|
132 | | - (dap-launch-remove-comments) |
| 132 | + (dap-launch-sanitize-json) |
133 | 133 | (buffer-string))) |
134 | 134 |
|
135 | 135 | (ert-deftest dap-launch-test--delete-comments () |
|
139 | 139 | /* \" // non-string */ |
140 | 140 | \"// string\" |
141 | 141 | \"/*string*/\"") |
142 | | - (post-exp (dap-launch-test--delete-string-comments orig))) |
| 142 | + (post-exp (dap-launch-test--sanitize-json orig))) |
143 | 143 | (should (string= post-exp " |
144 | 144 |
|
145 | 145 |
|
146 | 146 |
|
147 | 147 | \"// string\" |
148 | 148 | \"/*string*/\"")))) |
149 | 149 |
|
| 150 | +(ert-deftest dap-launch-test--delete-commas () |
| 151 | + (let ((orig "{ |
| 152 | + \"abc\": 123, |
| 153 | +}") |
| 154 | + (post-exp (dap-launch-test--sanitize-json orig))) |
| 155 | + (should (string= post-exp "{ |
| 156 | + \"abc\": 123 |
| 157 | +}")))) |
| 158 | + |
150 | 159 | (ert-deftest dap-launch-test--comment-in-string () |
151 | 160 | (let ((orig "\"// orig\"")) |
152 | | - (should (string= orig (dap-launch-test--delete-string-comments orig))))) |
| 161 | + (should (string= orig (dap-launch-test--sanitize-json orig))))) |
153 | 162 |
|
154 | 163 | (ert-deftest dap-launch-test--comment-star () |
155 | 164 | (let ((orig "/* * **/")) |
156 | | - (should (string-empty-p (dap-launch-test--delete-string-comments orig))))) |
| 165 | + (should (string-empty-p (dap-launch-test--sanitize-json orig))))) |
| 166 | + |
| 167 | +(ert-deftest dap-launch-test--comma-in-string () |
| 168 | + (let ((orig "\"abc, ]\"")) |
| 169 | + (should (string= orig (dap-launch-test--sanitize-json orig))))) |
157 | 170 |
|
158 | 171 |
|
159 | 172 | (defmacro dap-variables--define-compare-test (name conf expanded |
|
0 commit comments