1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Regression tests for fuzz-discovered parser inputs.
//!
//! This file is the bridge between `cargo fuzz`'s ephemeral working
//! corpus (which lives at `fuzz/corpus/<target>/` and is *not*
//! committed) and the permanent regression test suite (which runs
//! under `cargo test` and is committed). The workflow:
//!
//! 1. `cargo +nightly fuzz run <target> -- -max_total_time=3600`
//! 2. If the fuzzer produces an interesting input (a panic / hang /
//! OOM in pre-fix builds, or a particularly tricky edge case
//! worth permanent coverage), copy the relevant
//! `fuzz/corpus/<target>/<hash>` file into
//! `tests/corpus_seeds/<target>/<descriptive-name>` (committed).
//! 3. Add a `#[test]` block below that loads the file via
//! `include_bytes!`, transcodes to `&str`, and calls the
//! matching parser. The regression contract is "no panic, no
//! hang, no OOM" — `cargo test`'s normal runner enforces all
//! three.
//!
//! The current corpus is empty: v0.9.9 ships the harness and
//! v0.9.9.x / v1.0.x populates `tests/corpus_seeds/` as the
//! maintainer's clean fuzz runs surface inputs worth keeping
//! around as permanent regressions.
// =========================================================================
// Per-seed regression tests live below.
//
// Template (uncomment + adjust when a seed lands):
//
// #[test]
// fn hcl_parser_01_nested_block_terminator_in_string() {
// let bytes: &[u8] = include_bytes!(
// "corpus_seeds/hcl_parser/01_nested_block_terminator_in_string"
// );
// if let Ok(s) = std::str::from_utf8(bytes) {
// let _ = config_lib::parsers::hcl_parser::parse(s);
// }
// }
// =========================================================================
/// Sanity test so the integration-test binary isn't empty. Proves
/// the parser module re-exports are wired correctly and the file
/// compiles. Replaced or supplemented by real corpus entries as
/// they accumulate.
// =========================================================================
// v1.3.0: inputs found in review rather than by the fuzzer. Kept inline
// because each is a few bytes.
// =========================================================================
/// CONF sliced at a character count instead of a byte offset and
/// panicked when non-ASCII text came before a section header.
/// CONF parsed nested arrays recursively with no limit, so a run of `[`
/// overflowed the stack.
/// INI looped forever on a non-ASCII character and on a line starting
/// with a separator.
/// Properties refused a valid file with non-ASCII text in it.