use ryl::config::YamlLintConfig;

#[test]
fn error_on_non_bool_require_numeral() {
    let err = YamlLintConfig::from_yaml_str(
        "rules:\n  float-values:\n    require-numeral-before-decimal: 1\n",
    )
    .unwrap_err();
    assert!(err.contains("failed to parse config data:"), "{err}");
    assert!(err.contains("rules.float-values"), "{err}");
}

#[test]
fn error_on_unknown_option() {
    let err =
        YamlLintConfig::from_yaml_str("rules:\n  float-values:\n    minimum: true\n")
            .unwrap_err();
    assert!(err.contains("failed to parse config data:"), "{err}");
    assert!(err.contains("rules.float-values"), "{err}");
}

#[test]
fn error_on_non_string_option_key() {
    let err = YamlLintConfig::from_yaml_str("rules:\n  float-values:\n    1: true\n")
        .unwrap_err();
    assert!(err.contains("cannot convert non-string TOML key"), "{err}");
}
