|
| 1 | +// SPDX-License-Identifier: Apache-2.0 |
| 2 | +// Copyright Clément Joly and contributors. |
| 3 | +// |
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +// you may not use this file except in compliance with the License. |
| 6 | +// You may obtain a copy of the License at |
| 7 | +// |
| 8 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +// |
| 10 | +// Unless required by applicable law or agreed to in writing, software |
| 11 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +// See the License for the specific language governing permissions and |
| 14 | +// limitations under the License. |
| 15 | + |
| 16 | +use insta::assert_snapshot; |
| 17 | + |
| 18 | +use crate::tests::helpers::{all_valid_down, m_valid0_down, m_valid0_up, m_valid_fk_down}; |
| 19 | +use crate::*; |
| 20 | + |
| 21 | +#[test] |
| 22 | +fn test_m_display() { |
| 23 | + insta::assert_snapshot!("up_only", m_valid0_up()); |
| 24 | + insta::assert_snapshot!("up_only_alt", format!("{:#}", m_valid0_up())); |
| 25 | + |
| 26 | + insta::assert_snapshot!("up_down", m_valid0_down()); |
| 27 | + insta::assert_snapshot!("up_down_alt", format!("{:#}", m_valid0_down())); |
| 28 | + |
| 29 | + insta::assert_snapshot!("up_down_fk", m_valid_fk_down()); |
| 30 | + insta::assert_snapshot!("up_down_fk_alt", format!("{:#}", m_valid_fk_down())); |
| 31 | + |
| 32 | + let everything = M { |
| 33 | + up: "UP", |
| 34 | + up_hook: Some(Box::new(|_: &Transaction| Ok(()))), |
| 35 | + down: Some("DOWN"), |
| 36 | + down_hook: Some(Box::new(|_: &Transaction| Ok(()))), |
| 37 | + foreign_key_check: true, |
| 38 | + comment: Some("Comment, likely a filename in practice!"), |
| 39 | + }; |
| 40 | + insta::assert_snapshot!("everything", everything); |
| 41 | + insta::assert_debug_snapshot!("everything_debug", everything); |
| 42 | + insta::assert_compact_debug_snapshot!("everything_compact_debug", everything); |
| 43 | + insta::assert_snapshot!("everything_alt", format!("{everything:#}")); |
| 44 | +} |
0 commit comments