From 95ba7da1abcd18b49c1a2dfc16c8d0e34c64ef45 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Tue, 10 Mar 2020 22:52:43 +0800 Subject: Check only one fixture --- crates/test_utils/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/test_utils') diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 2432177b4..a0d8f4d37 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -207,7 +207,12 @@ pub fn parse_single_fixture(fixture: &str) -> Option { if !fixture.lines().any(|it| it.trim_start().starts_with("//-")) { return None; } - parse_fixture(fixture).into_iter().nth(0) + + let fixtures = parse_fixture(fixture); + if fixtures.len() > 1 { + panic!("too many fixtures"); + } + fixtures.into_iter().nth(0) } // Comparison functionality borrowed from cargo: -- cgit v1.2.3