update tests to include new API changes

This commit is contained in:
ConnorSkees 2020-04-18 19:08:35 -04:00
parent a3a218f950
commit 47b7ece6c5
2 changed files with 10 additions and 13 deletions

View File

@ -12,10 +12,8 @@ macro_rules! test_import {
write!(f, $content).unwrap(); write!(f, $content).unwrap();
)* )*
let mut buf = Vec::new(); let mut buf = Vec::new();
StyleSheet::new($input.to_string()) StyleSheet::new($input.to_string(), &mut buf)
.expect(concat!("failed to parse in ")) .expect(concat!("failed to parse on ", $input));
.print_as_css(&mut buf)
.expect(concat!("failed to pretty print on ", $input));
assert_eq!( assert_eq!(
String::from($output), String::from($output),
String::from_utf8(buf).expect("produced invalid utf8") String::from_utf8(buf).expect("produced invalid utf8")

View File

@ -8,10 +8,10 @@ macro_rules! test {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn $func() { fn $func() {
let mut buf = Vec::new(); let mut buf = Vec::new();
grass::StyleSheet::new($input.to_string()) grass::StyleSheet::new($input.to_string(), &mut buf)
.expect(concat!("failed to parse on ", $input)) .expect(concat!("failed to parse on ", $input));
.print_as_css(&mut buf) // .print_as_css()
.expect(concat!("failed to pretty print on ", $input)); // .expect(concat!("failed to pretty print on ", $input));
assert_eq!( assert_eq!(
String::from($input), String::from($input),
String::from_utf8(buf).expect("produced invalid utf8") String::from_utf8(buf).expect("produced invalid utf8")
@ -24,10 +24,8 @@ macro_rules! test {
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn $func() { fn $func() {
let mut buf = Vec::new(); let mut buf = Vec::new();
grass::StyleSheet::new($input.to_string()) grass::StyleSheet::new($input.to_string(), &mut buf)
.expect(concat!("failed to parse on ", $input)) .expect(concat!("failed to parse on ", $input));
.print_as_css(&mut buf)
.expect(concat!("failed to pretty print on ", $input));
assert_eq!( assert_eq!(
String::from($output), String::from($output),
String::from_utf8(buf).expect("produced invalid utf8") String::from_utf8(buf).expect("produced invalid utf8")
@ -45,7 +43,8 @@ macro_rules! error {
#[test] #[test]
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn $func() { fn $func() {
match grass::StyleSheet::new($input.to_string()) { let mut buf = Vec::new();
match grass::StyleSheet::new($input.to_string(), &mut buf) {
Ok(..) => panic!("did not fail"), Ok(..) => panic!("did not fail"),
Err(e) => assert_eq!($err, e.to_string() Err(e) => assert_eq!($err, e.to_string()
.chars() .chars()