use crate::{Kind, Token};

#[test]
fn properties() {
    let token: Token = Token::new(Kind::Symbol, "value", 1, 2);
    assert_eq!(token.kind(), Kind::Symbol);
    assert_eq!(token.value(), "value");
    assert_eq!(token.line(), 1);
    assert_eq!(token.position(), 2);
}

#[test]
fn display() {
    let token: Token = Token::new(Kind::NonAscii, "你好", 1, 2);
    assert_eq!(token.to_string(), "[non-ascii, ??, 1, 2]");

    let token: Token = Token::new(Kind::LineEnding, "\r\n", 1, 2);
    assert_eq!(token.to_string(), "[line-ending, rn, 1, 2]");

    let token: Token = Token::new(Kind::Whitespace, " \t", 1, 2);
    assert_eq!(token.to_string(), "[whitespace, st, 1, 2]");

    let token: Token = Token::new(Kind::Controls, "\x00\x7F", 1, 2);
    assert_eq!(token.to_string(), "[controls, ??, 1, 2]");

    let token: Token = Token::new(Kind::Symbol, "value", 1, 2);
    assert_eq!(token.to_string(), "[symbol, value, 1, 2]");

    let token: Token = Token::new(Kind::Special(b'*'), "*", 1, 2);
    assert_eq!(token.to_string(), "[special, *, 1, 2]");
}
