From 4d2f6a29a7ef56140d50638d47e307bb1abcd58c Mon Sep 17 00:00:00 2001 From: Jonathan Behrens Date: Sat, 13 May 2017 13:15:17 -0400 Subject: [PATCH] Add and improve tests of file_lines --- tests/source/file-lines-4.rs | 6 +++--- tests/source/file-lines-5.rs | 17 +++++++++++++++++ tests/source/file-lines-6.rs | 18 ++++++++++++++++++ tests/target/file-lines-4.rs | 6 +++--- tests/target/file-lines-5.rs | 17 +++++++++++++++++ tests/target/file-lines-6.rs | 18 ++++++++++++++++++ 6 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 tests/source/file-lines-5.rs create mode 100644 tests/source/file-lines-6.rs create mode 100644 tests/target/file-lines-5.rs create mode 100644 tests/target/file-lines-6.rs diff --git a/tests/source/file-lines-4.rs b/tests/source/file-lines-4.rs index c6c0a5f82a0..36b632c7df0 100644 --- a/tests/source/file-lines-4.rs +++ b/tests/source/file-lines-4.rs @@ -11,10 +11,10 @@ fn floaters() { let y = if cond { val1 } else { - val2 + val2 } .method_call(); - + // aaaaaaaaaaaaa { match x { PushParam => { @@ -24,6 +24,6 @@ fn floaters() { }] .clone()); } - } + } } } diff --git a/tests/source/file-lines-5.rs b/tests/source/file-lines-5.rs new file mode 100644 index 00000000000..8ec2c67bc44 --- /dev/null +++ b/tests/source/file-lines-5.rs @@ -0,0 +1,17 @@ +// rustfmt-file_lines: [{"file":"tests/source/file-lines-5.rs","range":[3,5]}] + +struct A { +t: i64, +} + +mod foo { + fn bar() { + // test + let i = 12; + // test + } + // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + fn baz() { + let j = 15; + } +} diff --git a/tests/source/file-lines-6.rs b/tests/source/file-lines-6.rs new file mode 100644 index 00000000000..2eacc8a0e75 --- /dev/null +++ b/tests/source/file-lines-6.rs @@ -0,0 +1,18 @@ +// rustfmt-file_lines: [{"file":"tests/source/file-lines-6.rs","range":[9,10]}] + +struct A { + t: i64, +} + +mod foo { + fn bar() { + // test + let i = 12; + // test + } + + fn baz() { +/// + let j = 15; + } +} diff --git a/tests/target/file-lines-4.rs b/tests/target/file-lines-4.rs index c6c0a5f82a0..36b632c7df0 100644 --- a/tests/target/file-lines-4.rs +++ b/tests/target/file-lines-4.rs @@ -11,10 +11,10 @@ fn floaters() { let y = if cond { val1 } else { - val2 + val2 } .method_call(); - + // aaaaaaaaaaaaa { match x { PushParam => { @@ -24,6 +24,6 @@ fn floaters() { }] .clone()); } - } + } } } diff --git a/tests/target/file-lines-5.rs b/tests/target/file-lines-5.rs new file mode 100644 index 00000000000..3966dc06303 --- /dev/null +++ b/tests/target/file-lines-5.rs @@ -0,0 +1,17 @@ +// rustfmt-file_lines: [{"file":"tests/source/file-lines-5.rs","range":[3,5]}] + +struct A { + t: i64, +} + +mod foo { + fn bar() { + // test + let i = 12; + // test + } + // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + fn baz() { + let j = 15; + } +} diff --git a/tests/target/file-lines-6.rs b/tests/target/file-lines-6.rs new file mode 100644 index 00000000000..8a092df869a --- /dev/null +++ b/tests/target/file-lines-6.rs @@ -0,0 +1,18 @@ +// rustfmt-file_lines: [{"file":"tests/source/file-lines-6.rs","range":[9,10]}] + +struct A { + t: i64, +} + +mod foo { + fn bar() { + // test + let i = 12; + // test + } + + fn baz() { +/// + let j = 15; + } +}