/*
dequote - Simple no-std text processing library
Written by Radim Kolar <hsn@sendmail.cz> 2024
https://gitlab.com/hsn10/dequote

This is free and unencumbered software released into the public domain.
For more information, please refer to <https://unlicense.org/>

CC0: This work has been marked as dedicated to the public domain.
For more information, please refer to <https://creativecommons.org/public-domain/cc0/>

SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#![forbid(unsafe_code)]

use super::{dequote};

//     D  E  Q  U  O  T  E     T E S T S

#[test]
/**
  No "
*/
fn no_op() {
   assert_eq!( dequote(&"nothing here"), "nothing here" );
}

#[test]
fn single_leading() {
   assert_eq!( dequote(&"\"kavat"), "\"kavat" );
}

#[test]
fn single_trailing() {
   assert_eq!( dequote(&"kavat\""), "kavat\"" );
}

#[test]
fn single_quote_1() {
   assert_eq!( dequote(&"\"kavat\""), "kavat" );
}

#[test]
fn single_quote_2() {
   assert_eq!( dequote(&"\'kavat\'"), "kavat" );
}

#[test]
fn single_quote_3() {
   assert_eq!( dequote(&"`kavat`"), "kavat" );
}

#[test]
fn double_quote() {
   assert_eq!( dequote(&"\"\'kavat\'\""), "kavat" );
}

#[test]
fn missmatched_double_quote() {
   assert_eq!( dequote(&"\"\'kavat\"\'"), "\"\'kavat\"\'" );
}

#[test]
fn missmatched_inner_quote() {
   assert_eq!( dequote(&"\"\'kavat`\""), "\'kavat`" );
}
