Skip to content

Commit

Permalink
Merge pull request #146 from kivikakk/propfuzz
Browse files Browse the repository at this point in the history
add propfuzz, very basic parsing test
  • Loading branch information
kivikakk authored Mar 19, 2021
2 parents 52ce8ac + 0e2dbf9 commit dfcdf49
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ shell-words = "1.0"

[dev-dependencies]
timebomb = "0.1.2"
propfuzz = "0.0.1"

[features]
default = ["clap"]
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ extern crate lazy_static;
extern crate pest;
#[macro_use]
extern crate pest_derive;
#[cfg(test)]
extern crate propfuzz;
extern crate regex;
#[cfg(feature = "benchmarks")]
extern crate test;
Expand Down
37 changes: 36 additions & 1 deletion src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,42 @@
use cm;
use html;
use propfuzz::prelude::*;
use timebomb::timeout_ms;
use {parse_document, Arena, ComrakOptions};
use {
parse_document, Arena, ComrakExtensionOptions, ComrakOptions, ComrakParseOptions,
ComrakRenderOptions,
};

#[propfuzz]
fn fuzz_doesnt_crash(md: String) {
let options = ComrakOptions {
extension: ComrakExtensionOptions {
strikethrough: true,
tagfilter: true,
table: true,
autolink: true,
tasklist: true,
superscript: true,
header_ids: Some("user-content-".to_string()),
footnotes: true,
description_lists: true,
front_matter_delimiter: None,
},
parse: ComrakParseOptions {
smart: true,
default_info_string: Some("Rust".to_string()),
},
render: ComrakRenderOptions {
hardbreaks: true,
github_pre_lang: true,
width: 80,
unsafe_: true,
escape: false,
},
};

parse_document(&Arena::new(), &md, &options);
}

fn compare_strs(output: &str, expected: &str, kind: &str) {
if output != expected {
Expand Down

0 comments on commit dfcdf49

Please sign in to comment.