2020-02-01 23:09:22 -05:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
macro_rules! test {
|
|
|
|
($func:ident, $input:literal) => {
|
|
|
|
#[test]
|
|
|
|
fn $func() {
|
|
|
|
let mut buf = Vec::new();
|
|
|
|
grass::StyleSheet::new($input)
|
2020-02-02 10:27:08 -05:00
|
|
|
.expect(concat!("failed to parse on ", $input))
|
|
|
|
.print_as_css(&mut buf)
|
|
|
|
.expect(concat!("failed to pretty print on ", $input));
|
2020-02-01 23:09:22 -05:00
|
|
|
assert_eq!(
|
|
|
|
String::from($input),
|
|
|
|
String::from_utf8(buf).expect("produced invalid utf8")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
($func:ident, $input:literal, $output:literal) => {
|
|
|
|
#[test]
|
|
|
|
fn $func() {
|
|
|
|
let mut buf = Vec::new();
|
|
|
|
grass::StyleSheet::new($input)
|
|
|
|
.expect(concat!("failed to parse on ", $input))
|
|
|
|
.print_as_css(&mut buf)
|
|
|
|
.expect(concat!("failed to pretty print on ", $input));
|
|
|
|
assert_eq!(
|
|
|
|
String::from($output),
|
|
|
|
String::from_utf8(buf).expect("produced invalid utf8")
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
2020-02-02 10:27:08 -05:00
|
|
|
}
|