Skip to content

Commit aede0c8

Browse files
committed
accounted for Windows occurring for new lines in testing
1 parent 006122c commit aede0c8

File tree

6 files changed

+38
-2
lines changed

6 files changed

+38
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,5 @@ target
3131
# already existing elements were commented out
3232

3333
#/target
34+
35+
ci-local.sh

cobertura.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

fuzz/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
corpus
3+
artifacts
4+
coverage

fuzz/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "sql_docs-fuzz"
3+
version = "0.0.0"
4+
publish = false
5+
edition = "2024"
6+
7+
[package.metadata]
8+
cargo-fuzz = true
9+
10+
[dependencies]
11+
libfuzzer-sys = "0.4"
12+
13+
[dependencies.sql_docs]
14+
path = ".."
15+
16+
[[bin]]
17+
name = "fuzz_target_1"
18+
path = "fuzz_targets/fuzz_target_1.rs"
19+
test = false
20+
doc = false
21+
bench = false

fuzz/fuzz_targets/fuzz_target_1.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![no_main]
2+
3+
use libfuzzer_sys::fuzz_target;
4+
5+
fuzz_target!(|data: &[u8]| {
6+
// fuzzed code goes here
7+
});

src/files.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ impl SqlFile {
116116
///
117117
/// Returns an [`io::Error`] if the file cannot be read.
118118
pub fn new(path: &Path) -> io::Result<Self> {
119-
let content = fs::read_to_string(path)?;
119+
let mut content = fs::read_to_string(path)?;
120+
if cfg!(windows) {
121+
content = content.replace("\r\n", "\n");
122+
}
120123
Ok(Self { path: path.to_owned(), content })
121124
}
122125

0 commit comments

Comments
 (0)