Sha256: 4cf1fdb26c3fd4e88eed5f6d49e8be866e56f43f4f8bc85d547f9630391272e9

Contents?: true

Size: 1.85 KB

Versions: 13

Compression:

Stored size: 1.85 KB

Contents

#[test]
#[cfg(not(feature = "unbounded"))]
fn array_recursion_limit() {
    let depths = [(1, true), (20, true), (300, false)];
    for (depth, is_ok) in depths {
        let input = format!("x={}{}", &"[".repeat(depth), &"]".repeat(depth));
        let document = input.parse::<toml_edit::DocumentMut>();
        assert_eq!(document.is_ok(), is_ok, "depth: {}", depth);
    }
}

#[test]
#[cfg(not(feature = "unbounded"))]
fn inline_table_recursion_limit() {
    let depths = [(1, true), (20, true), (300, false)];
    for (depth, is_ok) in depths {
        let input = format!("x={}true{}", &"{ x = ".repeat(depth), &"}".repeat(depth));
        let document = input.parse::<toml_edit::DocumentMut>();
        assert_eq!(document.is_ok(), is_ok, "depth: {}", depth);
    }
}

#[test]
#[cfg(not(feature = "unbounded"))]
fn table_key_recursion_limit() {
    let depths = [(1, true), (20, true), (300, false)];
    for (depth, is_ok) in depths {
        let input = format!("[x{}]", &".x".repeat(depth));
        let document = input.parse::<toml_edit::DocumentMut>();
        assert_eq!(document.is_ok(), is_ok, "depth: {}", depth);
    }
}

#[test]
#[cfg(not(feature = "unbounded"))]
fn dotted_key_recursion_limit() {
    let depths = [(1, true), (20, true), (300, false)];
    for (depth, is_ok) in depths {
        let input = format!("x{} = true", &".x".repeat(depth));
        let document = input.parse::<toml_edit::DocumentMut>();
        assert_eq!(document.is_ok(), is_ok, "depth: {}", depth);
    }
}

#[test]
#[cfg(not(feature = "unbounded"))]
fn inline_dotted_key_recursion_limit() {
    let depths = [(1, true), (20, true), (300, false)];
    for (depth, is_ok) in depths {
        let input = format!("x = {{ x{} = true }}", &".x".repeat(depth));
        let document = input.parse::<toml_edit::DocumentMut>();
        assert_eq!(document.is_ok(), is_ok, "depth: {}", depth);
    }
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/toml_edit-0.22.22/tests/testsuite/stackoverflow.rs
wasmtime-28.0.0 ./ext/cargo-vendor/toml_edit-0.22.22/tests/testsuite/stackoverflow.rs
wasmtime-27.0.0 ./ext/cargo-vendor/toml_edit-0.22.22/tests/testsuite/stackoverflow.rs
wasmtime-26.0.0 ./ext/cargo-vendor/toml_edit-0.22.22/tests/testsuite/stackoverflow.rs
wasmtime-25.0.2 ./ext/cargo-vendor/toml_edit-0.22.20/tests/testsuite/stackoverflow.rs
wasmtime-25.0.1 ./ext/cargo-vendor/toml_edit-0.22.20/tests/testsuite/stackoverflow.rs
wasmtime-25.0.0 ./ext/cargo-vendor/toml_edit-0.22.20/tests/testsuite/stackoverflow.rs
wasmtime-24.0.0 ./ext/cargo-vendor/toml_edit-0.22.20/tests/testsuite/stackoverflow.rs
wasmtime-23.0.2 ./ext/cargo-vendor/toml_edit-0.22.12/tests/testsuite/stackoverflow.rs
wasmtime-22.0.0 ./ext/cargo-vendor/toml_edit-0.22.12/tests/testsuite/stackoverflow.rs
wasmtime-21.0.1 ./ext/cargo-vendor/toml_edit-0.22.12/tests/testsuite/stackoverflow.rs
wasmtime-20.0.2 ./ext/cargo-vendor/toml_edit-0.22.12/tests/testsuite/stackoverflow.rs
wasmtime-20.0.0 ./ext/cargo-vendor/toml_edit-0.22.12/tests/testsuite/stackoverflow.rs