diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2016-02-12 14:59:13 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2016-02-12 14:59:13 +1300 |
| commit | d86cfb357aef2d70e67e616f60ca587bd12def62 (patch) | |
| tree | 5efd7a7070a2252eef5b79d015334b6a61193c46 /tests | |
| parent | c906b656e61d0413cd411dcb6dbe8a4222bf3ab3 (diff) | |
Format all patterns (well, except macros)
Fixes #18 Fixes #672
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/source/pattern.rs | 14 | ||||
| -rw-r--r-- | tests/system.rs | 2 | ||||
| -rw-r--r-- | tests/target/match.rs | 2 | ||||
| -rw-r--r-- | tests/target/pattern.rs | 17 |
4 files changed, 34 insertions, 1 deletions
diff --git a/tests/source/pattern.rs b/tests/source/pattern.rs index 930ffe2258f..75f65806167 100644 --- a/tests/source/pattern.rs +++ b/tests/source/pattern.rs @@ -11,6 +11,20 @@ fn main() { let Some ( ref xyz /* comment! */) = opt; if let None = opt2 { panic!("oh noes"); } + + let foo@bar (f) = 42; + let a::foo ( ..) = 42; + let [ ] = 42; + let [a.., b,c ] = 42; + let [ a,b,c.. ] = 42; + let [a, b, c, d..,e,f, g] = 42; + let foo { } = 42; + let foo {..} = 42; + let foo { x, y: ref foo, .. } = 42; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, .. } = 42; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, } = 42; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, .. }; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, }; } impl<'a,'b> ResolveGeneratedContentFragmentMutator<'a,'b> { diff --git a/tests/system.rs b/tests/system.rs index 497583f9d67..bc5298ae22d 100644 --- a/tests/system.rs +++ b/tests/system.rs @@ -287,6 +287,8 @@ fn handle_result(result: HashMap<String, String>, if fmt_text != text { let diff = make_diff(&text, &fmt_text, DIFF_CONTEXT_SIZE); + assert!(!diff.is_empty(), + "Empty diff? Maybe due to a missing a newline at the end of a file?"); failures.insert(file_name, diff); } } diff --git a/tests/target/match.rs b/tests/target/match.rs index 94f9bf8ae5e..defcc13ef51 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -251,7 +251,7 @@ fn issue280() { fn issue383() { match resolution.last_private { - LastImport{..} => false, + LastImport { .. } => false, _ => true, }; } diff --git a/tests/target/pattern.rs b/tests/target/pattern.rs index eb42f9fde73..d77cb59f498 100644 --- a/tests/target/pattern.rs +++ b/tests/target/pattern.rs @@ -13,6 +13,23 @@ fn main() { if let None = opt2 { panic!("oh noes"); } + + let foo @ bar(f) = 42; + let a::foo(..) = 42; + let [] = 42; + let [a.., b, c] = 42; + let [a, b, c..] = 42; + let [a, b, c, d.., e, f, g] = 42; + let foo {} = 42; + let foo { .. } = 42; + let foo { x, y: ref foo, .. } = 42; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, .. } = 42; + let foo { x, yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo } = 42; + let foo { x, + yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo, + .. }; + let foo { x, + yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: ref foo }; } impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> { |
