about summary refs log tree commit diff
path: root/src/libsyntax/util
diff options
context:
space:
mode:
authorMurarth <murarth@gmail.com>2014-11-17 14:37:59 -0700
committerMurarth <murarth@gmail.com>2014-11-17 20:26:21 -0700
commit2293a04b4936a11fc3e09f3df8a8ab591e034f29 (patch)
treebb7b2439ddcc50918c09624e73d1b178601c0a4a /src/libsyntax/util
parent7ef200774fbb8e5f4961f63a83cf5bbe27cd5f8f (diff)
downloadrust-2293a04b4936a11fc3e09f3df8a8ab591e034f29.tar.gz
rust-2293a04b4936a11fc3e09f3df8a8ab591e034f29.zip
libsyntax: Add tests for `parse_view_item`
Diffstat (limited to 'src/libsyntax/util')
-rw-r--r--src/libsyntax/util/parser_testing.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index d0faa3c6820..c1ea8f60b82 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -67,6 +67,13 @@ pub fn string_to_stmt(source_str : String) -> P<ast::Stmt> {
     })
 }
 
+/// Parse a string, return a view item
+pub fn string_to_view_item (source_str : String) -> ast::ViewItem {
+    with_error_checking_parse(source_str, |p| {
+        p.parse_view_item(Vec::new())
+    })
+}
+
 /// Parse a string, return a pat. Uses "irrefutable"... which doesn't
 /// (currently) affect parsing.
 pub fn string_to_pat(source_str: String) -> P<ast::Pat> {