//! Section 7.2 — Invalid examples.

use crate::{parse, ParseError};

/// 7.2 Example 1 — dash in key.
#[test]
fn dash_in_key() {
    let errors = parse(b"KEY-NAME=value\n").unwrap_err();
    assert_eq!(errors, vec![ParseError::InvalidKeyError { line: 1 }]);
}

/// 7.2 Example 2 — key cannot start with a digit.
#[test]
fn digit_start_key() {
    let errors = parse(b"123KEY=value\n").unwrap_err();
    assert_eq!(errors, vec![ParseError::InvalidKeyError { line: 1 }]);
}

/// 7.2 Example 3 — period in key.
#[test]
fn period_in_key() {
    let errors = parse(b"KEY.NAME=value\n").unwrap_err();
    assert_eq!(errors, vec![ParseError::InvalidKeyError { line: 1 }]);
}

/// 7.2 Example 4 — missing `=` operator.
#[test]
fn missing_operator() {
    let errors = parse(b"KEY value\n").unwrap_err();
    assert_eq!(errors, vec![ParseError::MissingOperatorError { line: 1 }]);
}

/// 7.2 Example 5 — empty key.
#[test]
fn empty_key() {
    let errors = parse(b"=value\n").unwrap_err();
    assert_eq!(errors, vec![ParseError::EmptyKeyError { line: 1 }]);
}
