Tentative beginning to implementing Parse for Expr types
diff --git a/tests/test_parse.rs b/tests/test_parse.rs
new file mode 100644
index 0000000..b99ef2b
--- /dev/null
+++ b/tests/test_parse.rs
@@ -0,0 +1,28 @@
+extern crate proc_macro2;
+extern crate syn;
+
+use std::str::FromStr;
+
+use proc_macro2::TokenStream;
+use syn::{Expr, parse2};
+
+#[test]
+fn test_expr_parse() {
+ macro_rules! test_equiv {
+ ($code:ident, $old:ident, $new:ident) => (
+ let tt = TokenStream::from_str($code).unwrap();
+ //println!("--- tt ---\n{:?}\n", tt);
+ let ast1: Expr = parse2(tt.clone()).unwrap();
+ //println!("--- ast1 ---\n{:?}\n", ast1);
+ let ast2: syn::$new = parse2(tt).unwrap();
+ //println!("--- ast2 ---\n{:?}\n", ast2);
+ assert_eq!(ast1, Expr::$old(ast2));
+ )
+ }
+
+ let code = "match foo { Bar::Qux => (), _ => panic!() }";
+ test_equiv!(code, Match, ExprMatch);
+
+ let code = "..100u32";
+ test_equiv!(code, Range, ExprRange);
+}