| 646 | |
| 647 | #[test] |
| 648 | fn test_should_ignore_file() { |
| 649 | #[cfg(not(target_os = "windows"))] |
| 650 | let path = Path::new("src/http.rs"); |
| 651 | #[cfg(target_os = "windows")] |
| 652 | let path = Path::new("src\\http.rs"); |
| 653 | |
| 654 | let ignore_files = vec![]; |
| 655 | let mut template_config = TemplateConfig::default(); |
| 656 | template_config.ignore_conditional_files.insert( |
| 657 | "src/http.rs".into(), |
| 658 | RenderCondition { |
| 659 | var: "http_function".into(), |
| 660 | r#match: None, |
| 661 | not_match: Some(PromptValue::Boolean(true)), |
| 662 | }, |
| 663 | ); |
| 664 | |
| 665 | let mut variables = Object::new(); |
| 666 | variables.insert("http_function".into(), Value::scalar(false)); |
| 667 | |
| 668 | assert!(should_ignore_file( |
| 669 | path, |
| 670 | &ignore_files, |
| 671 | &template_config, |
| 672 | &variables |
| 673 | )); |
| 674 | } |
| 675 | |
| 676 | #[test] |
| 677 | fn test_should_not_ignore_file() { |