mirror of
https://github.com/simonask/libyaml-safer
synced 2024-11-24 12:23:02 +00:00
More lints
This commit is contained in:
parent
c3d1aba783
commit
5ebedb67ec
6 changed files with 9 additions and 9 deletions
|
@ -5,9 +5,9 @@ use libyaml_safer::{
|
||||||
yaml_document_get_root_node, yaml_parser_load, yaml_parser_new, yaml_parser_set_input,
|
yaml_document_get_root_node, yaml_parser_load, yaml_parser_new, yaml_parser_set_input,
|
||||||
};
|
};
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) });
|
fuzz_target!(|data: &[u8]| fuzz_target(data));
|
||||||
|
|
||||||
unsafe fn fuzz_target(mut data: &[u8]) {
|
fn fuzz_target(mut data: &[u8]) {
|
||||||
let mut parser = yaml_parser_new();
|
let mut parser = yaml_parser_new();
|
||||||
yaml_parser_set_input(&mut parser, &mut data);
|
yaml_parser_set_input(&mut parser, &mut data);
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
use libyaml_safer::{yaml_parser_new, yaml_parser_parse, yaml_parser_set_input, EventData};
|
use libyaml_safer::{yaml_parser_new, yaml_parser_parse, yaml_parser_set_input, EventData};
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) });
|
fuzz_target!(|data: &[u8]| fuzz_target(data));
|
||||||
|
|
||||||
unsafe fn fuzz_target(mut data: &[u8]) {
|
fn fuzz_target(mut data: &[u8]) {
|
||||||
let mut parser = yaml_parser_new();
|
let mut parser = yaml_parser_new();
|
||||||
yaml_parser_set_input(&mut parser, &mut data);
|
yaml_parser_set_input(&mut parser, &mut data);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use libfuzzer_sys::fuzz_target;
|
use libfuzzer_sys::fuzz_target;
|
||||||
use libyaml_safer::{yaml_parser_new, yaml_parser_scan, yaml_parser_set_input, TokenData};
|
use libyaml_safer::{yaml_parser_new, yaml_parser_scan, yaml_parser_set_input, TokenData};
|
||||||
|
|
||||||
fuzz_target!(|data: &[u8]| unsafe { fuzz_target(data) });
|
fuzz_target!(|data: &[u8]| fuzz_target(data));
|
||||||
|
|
||||||
fn fuzz_target(mut data: &[u8]) {
|
fn fuzz_target(mut data: &[u8]) {
|
||||||
let mut parser = yaml_parser_new();
|
let mut parser = yaml_parser_new();
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn test(id: &str) {
|
||||||
|
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
eprint!("{}", stderr);
|
eprint!("{stderr}");
|
||||||
|
|
||||||
let out = if dir.join("out.yaml").exists() {
|
let out = if dir.join("out.yaml").exists() {
|
||||||
dir.join("out.yaml")
|
dir.join("out.yaml")
|
||||||
|
|
|
@ -22,7 +22,7 @@ fn test(id: &str) {
|
||||||
|
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
eprint!("{}", stderr);
|
eprint!("{stderr}");
|
||||||
|
|
||||||
let expected = fs::read_to_string(dir.join("test.event")).unwrap();
|
let expected = fs::read_to_string(dir.join("test.event")).unwrap();
|
||||||
pretty_assertions::assert_str_eq!(expected, stdout);
|
pretty_assertions::assert_str_eq!(expected, stdout);
|
||||||
|
|
|
@ -22,8 +22,8 @@ fn test(id: &str) {
|
||||||
if output.success {
|
if output.success {
|
||||||
let stdout = String::from_utf8_lossy(&output.stdout);
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
||||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||||
eprint!("{}", stdout);
|
eprint!("{stdout}");
|
||||||
eprint!("{}", stderr);
|
eprint!("{stderr}");
|
||||||
panic!("expected parse to fail");
|
panic!("expected parse to fail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue