Skip to content

Commit

Permalink
Merge #836
Browse files Browse the repository at this point in the history
836: test: Add tests for #793 r=Marwes a=Marwes

Was presumably fixed in #696

Closes #793

Co-authored-by: Markus Westerlind <[email protected]>
  • Loading branch information
bors[bot] and Marwes authored May 17, 2020
2 parents e1ac79f + 11774fe commit 77652ab
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions format/tests/pretty_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@ use difference::assert_diff;

use gluon::{RootedThread, ThreadExt, VmBuilder};

macro_rules! test_format {
($name: ident, $initial: expr) => {
test_format! { $name, $initial, $initial }
};
($name: ident, $initial: expr, $formatted: expr) => {
#[test]
fn $name() {
let initial = $initial;
let expr = $formatted;

let once = format_expr(initial).unwrap();
assert_diff!(&once, expr, "\n", 0);
assert_diff!(&format_expr(&once).unwrap(), expr, "\n", 0);
}
};
}

fn new_vm() -> RootedThread {
VmBuilder::new()
.import_paths(Some(vec![".".into(), "..".into()]))
Expand Down Expand Up @@ -781,3 +798,34 @@ type OpenVariant r a = .. r
"#;
assert_diff!(&format_expr(expr).unwrap(), expr, "\n", 0);
}

test_format! {
issue_793_1,
r#"
let gectvbzppia : alrkvbjaklbvapouhvgtbvvnaipryrbipajlkm
vhieurabrlvikbnvliaejnbae
vhieurabrlvikbnvliaejnbaeoribfhknjeanhbtbaejnbaetiekjnajkrhblbrfvbrkkajbevels
vhieurabrlvikbnvliaejnbaeoribfhknjeanhbtbaejnb
vhieurabrlvikbnvliaejn
=
x
()
"#
}

test_format! {
issue_793_2,
r#"
let assert_success : [Show e] -> Eff [| error : Error e, writer : Test | r |] a -> Eff [| writer : Test | r |] ()
= run_error >> flat_map assert_ok
()
"#,
r#"
let assert_success : [Show e]
-> Eff [| error : Error e, writer : Test | r |] a
-> Eff [| writer : Test | r |] ()
=
run_error >> flat_map assert_ok
()
"#
}

0 comments on commit 77652ab

Please sign in to comment.