MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / comments_to_test_str

Function comments_to_test_str

tests/test.rs:223–239  ·  view source on GitHub ↗
(comments: (&usize, &Rc<Vec<Comment>>))

Source from the content-addressed store, hash-verified

221}
222
223fn comments_to_test_str(comments: (&usize, &Rc<Vec<Comment>>)) -> String {
224 let mut text = String::new();
225 text.push_str("{\n");
226 text.push_str(&format!(" \"pos\": {},\n", comments.0));
227 text.push_str(" \"comments\": [");
228 let comments_count = comments.1.len();
229 for (i, comment) in comments.1.iter().enumerate() {
230 text.push_str("\n ");
231 text.push_str(&comment_to_test_str(comment).replace("\n", "\n "));
232 if i + 1 < comments_count {
233 text.push(',');
234 }
235 }
236 text.push_str("\n ]\n");
237 text.push('}');
238 text
239}
240
241fn comment_to_test_str(comment: &Comment) -> String {
242 match comment {

Callers 1

parse_result_to_test_strFunction · 0.85

Calls 3

comment_to_test_strFunction · 0.85
lenMethod · 0.80
iterMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…