mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Rust: Add more test cases for comments.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
| comments.rs:0:0:0:0 | comments.rs | File successfully extracted. |
|
||||
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | File successfully extracted. |
|
||||
| error.rs:0:0:0:0 | error.rs | File successfully extracted. |
|
||||
| lib.rs:0:0:0:0 | lib.rs | File successfully extracted. |
|
||||
|
||||
@@ -1 +1 @@
|
||||
| 46 |
|
||||
| 68 |
|
||||
|
||||
@@ -1 +1 @@
|
||||
| 46 |
|
||||
| 68 |
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
| comments.rs:0:0:0:0 | comments.rs | 20 |
|
||||
| my_struct.rs:0:0:0:0 | my_struct.rs | 20 |
|
||||
| main.rs:0:0:0:0 | main.rs | 7 |
|
||||
| main.rs:0:0:0:0 | main.rs | 8 |
|
||||
| lib.rs:0:0:0:0 | lib.rs | 7 |
|
||||
| my_macro.rs:0:0:0:0 | my_macro.rs | 7 |
|
||||
| lib.rs:0:0:0:0 | lib.rs | 6 |
|
||||
| does_not_compile.rs:0:0:0:0 | does_not_compile.rs | 3 |
|
||||
| error.rs:0:0:0:0 | error.rs | 3 |
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
| Elements extracted | 216 |
|
||||
| Elements extracted | 290 |
|
||||
| Elements unextracted | 0 |
|
||||
| Files extracted | 6 |
|
||||
| Lines of code extracted | 46 |
|
||||
| Lines of user code extracted | 46 |
|
||||
| Files extracted | 7 |
|
||||
| Lines of code extracted | 68 |
|
||||
| Lines of user code extracted | 68 |
|
||||
|
||||
60
rust/ql/test/query-tests/diagnostics/comments.rs
Normal file
60
rust/ql/test/query-tests/diagnostics/comments.rs
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* total lines in this file: 61
|
||||
* of which code: 16
|
||||
* of which only comments: 33
|
||||
* of which blank: 12
|
||||
*/
|
||||
|
||||
// a comment
|
||||
|
||||
/**
|
||||
* Comment attached to a struct.
|
||||
*/
|
||||
struct StructWithComments
|
||||
{
|
||||
/**
|
||||
* Another attached comment.
|
||||
*/
|
||||
a: i32,
|
||||
|
||||
// And another attached comment.
|
||||
b: i32,
|
||||
|
||||
/*
|
||||
* And yet another attached comment.
|
||||
*/
|
||||
c: i32,
|
||||
|
||||
// informal
|
||||
// comment
|
||||
// block.
|
||||
cd: i32,
|
||||
|
||||
// Just a comment.
|
||||
}
|
||||
|
||||
pub fn my_simple_func()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment attached to a function.
|
||||
*/
|
||||
pub fn my_func_with_comments()
|
||||
{
|
||||
// comment
|
||||
let a = 1; // comment
|
||||
// comment
|
||||
let b = 2;
|
||||
|
||||
// comment
|
||||
|
||||
/*
|
||||
* Comment.
|
||||
*/
|
||||
my_simple_func();
|
||||
}
|
||||
|
||||
/**
|
||||
* Comment.
|
||||
*/
|
||||
@@ -1,16 +1,15 @@
|
||||
/**
|
||||
* total lines in this file: 18
|
||||
* of which code: 7
|
||||
* of which only comments: 7
|
||||
* of which code: 8
|
||||
* of which only comments: 6
|
||||
* of which blank: 4
|
||||
*/
|
||||
|
||||
mod my_struct;
|
||||
mod my_macro;
|
||||
mod comments;
|
||||
|
||||
// another comment
|
||||
|
||||
fn main() { // another comment
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
|
||||
my_struct::my_func();
|
||||
|
||||
Reference in New Issue
Block a user