File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,43 @@ use predicates::prelude::*;
33use std:: fs;
44use tempfile:: tempdir;
55
6+ #[ test]
7+ fn test_init ( ) {
8+ let temp_dir = tempdir ( ) . unwrap ( ) ;
9+
10+ let mut cmd = cargo_bin_cmd ! ( "ml-cellar" ) ;
11+ cmd. arg ( "init" ) ;
12+ cmd. current_dir ( temp_dir. path ( ) ) ;
13+ cmd. assert ( ) . success ( ) ;
14+
15+ // Check .gitattributes
16+ let gitattributes_path = temp_dir. path ( ) . join ( ".gitattributes" ) ;
17+ assert ! ( gitattributes_path. is_file( ) , ".gitattributes should exist" ) ;
18+
19+ let gitattributes_text = fs:: read_to_string ( & gitattributes_path) . unwrap ( ) ;
20+ let target_gitattributes = fs:: read_to_string ( "tests/fixtures/.gitattributes" ) . unwrap ( ) ;
21+ assert ! (
22+ gitattributes_text == target_gitattributes,
23+ ".gitattributes is \n ***\n {} \n *** \n and different from the target file." ,
24+ gitattributes_text
25+ ) ;
26+
27+ // Check .mlcellar.toml
28+ let repository_config_path = temp_dir. path ( ) . join ( ".mlcellar.toml" ) ;
29+ assert ! (
30+ repository_config_path. is_file( ) ,
31+ ".mlcellar.toml should exist"
32+ ) ;
33+
34+ let mlcellar_text = fs:: read_to_string ( & repository_config_path) . unwrap ( ) ;
35+ let target_mlcellar = fs:: read_to_string ( "tests/fixtures/.mlcellar.toml" ) . unwrap ( ) ;
36+ assert ! (
37+ mlcellar_text == target_mlcellar,
38+ ".mlcellar.toml is \n ***\n {} \n *** \n and different from the target file." ,
39+ mlcellar_text
40+ ) ;
41+ }
42+
643#[ test]
744fn test_project ( ) {
845 let temp_dir = tempdir ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments