From dcd3c0ed2e5b892aa3e5cae5c90db958fd9c90d6 Mon Sep 17 00:00:00 2001 From: Michael Killough Date: Tue, 16 May 2017 16:13:23 +0700 Subject: [PATCH] Add test for issue #1366. As the comments in the issue state: it appears to work now, so this test should just stop any regressions. The second example in the issue description will format to the first, which is then a fixed-point. --- tests/source/issue-1366.rs | 12 ++++++++++++ tests/target/issue-1366.rs | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/source/issue-1366.rs create mode 100644 tests/target/issue-1366.rs diff --git a/tests/source/issue-1366.rs b/tests/source/issue-1366.rs new file mode 100644 index 00000000000..9d2964fc77c --- /dev/null +++ b/tests/source/issue-1366.rs @@ -0,0 +1,12 @@ +fn main() { + fn f() -> Option { + Some("fffffffsssssssssddddssssfffffddddff").map(|s| s).map(|s| s.to_string()).map(|res| { + match Some(res) { + Some(ref s) if s == "" => 41, + Some(_) => 42, + _ => 43, + } + }) + } + println!("{:?}", f()) +} diff --git a/tests/target/issue-1366.rs b/tests/target/issue-1366.rs new file mode 100644 index 00000000000..927aabc5018 --- /dev/null +++ b/tests/target/issue-1366.rs @@ -0,0 +1,13 @@ +fn main() { + fn f() -> Option { + Some("fffffffsssssssssddddssssfffffddddff") + .map(|s| s) + .map(|s| s.to_string()) + .map(|res| match Some(res) { + Some(ref s) if s == "" => 41, + Some(_) => 42, + _ => 43, + }) + } + println!("{:?}", f()) +}