Skip to content

Commit bcd481b

Browse files
committed
Add loc test for namespace
1 parent c577794 commit bcd481b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎src/metrics/loc.rs‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,4 +1404,28 @@ mod tests {
14041404
]
14051405
);
14061406
}
1407+
1408+
#[test]
1409+
fn cpp_namespace_loc() {
1410+
check_metrics!(
1411+
"namespace mozilla::dom::quota {} // namespace mozilla::dom::quota",
1412+
"foo.cpp",
1413+
CppParser,
1414+
loc,
1415+
[
1416+
(sloc, 1, usize), // The number of lines is 1
1417+
(ploc, 1, usize), // The number of code lines is 1
1418+
(lloc, 0, usize), // The number of statements is 0
1419+
(cloc, 1, usize), // The number of comments is 1
1420+
(blank, 0, usize) // The number of blank lines is 0
1421+
],
1422+
[
1423+
(sloc_average, 0.5), // The number of spaces is 2
1424+
(ploc_average, 0.5),
1425+
(lloc_average, 0.0),
1426+
(cloc_average, 0.5),
1427+
(blank_average, 0.0)
1428+
]
1429+
);
1430+
}
14071431
}

0 commit comments

Comments
 (0)