about summary refs log tree commit diff
path: root/src/libsyntax/print/pprust
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/print/pprust')
-rw-r--r--src/libsyntax/print/pprust/tests.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax/print/pprust/tests.rs b/src/libsyntax/print/pprust/tests.rs
index 97df7e6dcbd..082a430e0ed 100644
--- a/src/libsyntax/print/pprust/tests.rs
+++ b/src/libsyntax/print/pprust/tests.rs
@@ -5,6 +5,22 @@ use crate::source_map;
 use crate::with_default_globals;
 use syntax_pos;
 
+fn fun_to_string(
+    decl: &ast::FnDecl, header: ast::FnHeader, name: ast::Ident, generics: &ast::Generics
+) -> String {
+    to_string(|s| {
+        s.head("");
+        s.print_fn(decl, header, Some(name),
+                   generics, &source_map::dummy_spanned(ast::VisibilityKind::Inherited));
+        s.end(); // Close the head box
+        s.end(); // Close the outer box
+    })
+}
+
+fn variant_to_string(var: &ast::Variant) -> String {
+    to_string(|s| s.print_variant(var))
+}
+
 #[test]
 fn test_fun_to_string() {
     with_default_globals(|| {