diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/rustfmt/tests/target/format_strings | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
5 files changed, 83 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/target/format_strings/issue-202.rs b/src/tools/rustfmt/tests/target/format_strings/issue-202.rs new file mode 100644 index 000000000..2a2c24140 --- /dev/null +++ b/src/tools/rustfmt/tests/target/format_strings/issue-202.rs @@ -0,0 +1,25 @@ +// rustfmt-format_strings: true + +#[test] +fn compile_empty_program() { + let result = get_result(); + let expected = "; ModuleID = \'foo\' + +; Function Attrs: nounwind +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #0 + +declare i32 @write(i32, i8*, i32) + +declare i32 @putchar(i32) + +declare i32 @getchar() + +define i32 @main() { +entry: + ret i32 0 +} + +attributes #0 = { nounwind } +"; + assert_eq!(result, CString::new(expected).unwrap()); +} diff --git a/src/tools/rustfmt/tests/target/format_strings/issue-2833.rs b/src/tools/rustfmt/tests/target/format_strings/issue-2833.rs new file mode 100644 index 000000000..704835325 --- /dev/null +++ b/src/tools/rustfmt/tests/target/format_strings/issue-2833.rs @@ -0,0 +1,15 @@ +// rustfmt-format_strings: true +// rustfmt-max_width: 80 + +fn test1() { + let expected = "\ +but Doctor Watson has to have it taken out for him and dusted, +"; +} + +fn test2() { + let expected = "\ +[Omitted long matching line] +but Doctor Watson has to have it taken out for him and dusted, +"; +} diff --git a/src/tools/rustfmt/tests/target/format_strings/issue-3263.rs b/src/tools/rustfmt/tests/target/format_strings/issue-3263.rs new file mode 100644 index 000000000..72f7e9cc6 --- /dev/null +++ b/src/tools/rustfmt/tests/target/format_strings/issue-3263.rs @@ -0,0 +1,26 @@ +// rustfmt-format_strings: true +// rustfmt-newline_style: Windows + +#[test] +fn compile_empty_program() { + let result = get_result(); + let expected = "; ModuleID = \'foo\' + +; Function Attrs: nounwind +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) #0 + +declare i32 @write(i32, i8*, i32) + +declare i32 @putchar(i32) + +declare i32 @getchar() + +define i32 @main() { +entry: + ret i32 0 +} + +attributes #0 = { nounwind } +"; + assert_eq!(result, CString::new(expected).unwrap()); +} diff --git a/src/tools/rustfmt/tests/target/format_strings/issue-687.rs b/src/tools/rustfmt/tests/target/format_strings/issue-687.rs new file mode 100644 index 000000000..21d292f9e --- /dev/null +++ b/src/tools/rustfmt/tests/target/format_strings/issue-687.rs @@ -0,0 +1,10 @@ +// rustfmt-format_strings: true + +fn foo() -> &'static str { + let sql = "ATTACH DATABASE ':memory:' AS my_attached; + BEGIN; + CREATE TABLE my_attached.foo(x INTEGER); + INSERT INTO my_attached.foo VALUES(42); + END;"; + sql +} diff --git a/src/tools/rustfmt/tests/target/format_strings/issue564.rs b/src/tools/rustfmt/tests/target/format_strings/issue564.rs new file mode 100644 index 000000000..d9ef077c2 --- /dev/null +++ b/src/tools/rustfmt/tests/target/format_strings/issue564.rs @@ -0,0 +1,7 @@ +// rustfmt-format_strings: true + +const USAGE: &'static str = " +Usage: codegen project <name> <digits> <len> <codes> <prizes> <step> <shift> + codegen regenerate <name> + codegen verify <name> <code> +"; |