summaryrefslogtreecommitdiffstats
path: root/tests/pretty
diff options
context:
space:
mode:
Diffstat (limited to 'tests/pretty')
-rw-r--r--tests/pretty/format-args-str-escape.pp21
-rw-r--r--tests/pretty/format-args-str-escape.rs10
-rw-r--r--tests/pretty/hir-fn-variadic.pp15
-rw-r--r--tests/pretty/hir-fn-variadic.rs13
4 files changed, 59 insertions, 0 deletions
diff --git a/tests/pretty/format-args-str-escape.pp b/tests/pretty/format-args-str-escape.pp
new file mode 100644
index 000000000..b84bc2303
--- /dev/null
+++ b/tests/pretty/format-args-str-escape.pp
@@ -0,0 +1,21 @@
+#![feature(prelude_import)]
+#![no_std]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+// pretty-compare-only
+// pretty-mode:expanded
+// pp-exact:format-args-str-escape.pp
+
+fn main() {
+ { ::std::io::_print(format_args!("\u{1b}[1mHello, world!\u{1b}[0m\n")); };
+ { ::std::io::_print(format_args!("\u{1b}[1mHello, world!\u{1b}[0m\n")); };
+ {
+ ::std::io::_print(format_args!("Not an escape sequence: \\u{{1B}}[1mbold\\x1B[0m\n"));
+ };
+ {
+ ::std::io::_print(format_args!("{0}\n",
+ "\x1B[1mHello, world!\x1B[0m"));
+ };
+}
diff --git a/tests/pretty/format-args-str-escape.rs b/tests/pretty/format-args-str-escape.rs
new file mode 100644
index 000000000..e596fcfd8
--- /dev/null
+++ b/tests/pretty/format-args-str-escape.rs
@@ -0,0 +1,10 @@
+// pretty-compare-only
+// pretty-mode:expanded
+// pp-exact:format-args-str-escape.pp
+
+fn main() {
+ println!("\x1B[1mHello, world!\x1B[0m");
+ println!("\u{1B}[1mHello, world!\u{1B}[0m");
+ println!("Not an escape sequence: \\u{{1B}}[1mbold\\x1B[0m");
+ println!("{}", "\x1B[1mHello, world!\x1B[0m");
+}
diff --git a/tests/pretty/hir-fn-variadic.pp b/tests/pretty/hir-fn-variadic.pp
new file mode 100644
index 000000000..577d9400a
--- /dev/null
+++ b/tests/pretty/hir-fn-variadic.pp
@@ -0,0 +1,15 @@
+// pretty-compare-only
+// pretty-mode:hir
+// pp-exact:hir-fn-variadic.pp
+
+#![feature(c_variadic)]
+#[prelude_import]
+use ::std::prelude::rust_2015::*;
+#[macro_use]
+extern crate std;
+
+extern "C" {
+ fn foo(x: i32, va1: ...);
+}
+
+unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize { va2.arg::<usize>() }
diff --git a/tests/pretty/hir-fn-variadic.rs b/tests/pretty/hir-fn-variadic.rs
new file mode 100644
index 000000000..efb2754df
--- /dev/null
+++ b/tests/pretty/hir-fn-variadic.rs
@@ -0,0 +1,13 @@
+// pretty-compare-only
+// pretty-mode:hir
+// pp-exact:hir-fn-variadic.pp
+
+#![feature(c_variadic)]
+
+extern "C" {
+ pub fn foo(x: i32, va1: ...);
+}
+
+pub unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize {
+ va2.arg::<usize>()
+}