@@ -47,8 +47,96 @@ libs = ["lib"]
47
47
forge-std = "1.8.1"
48
48
"# ;
49
49
50
- let actual_foundry_contents = read_file_to_string( & foundry_file) ;
51
- assert_eq!( foundry_contents, actual_foundry_contents) ;
50
+ assert_data_eq!( read_file_to_string( & foundry_file) , foundry_contents) ;
51
+ } ) ;
52
+
53
+ forgesoldeer ! ( install_dependency_git, |prj, cmd| {
54
+ let command = "install" ;
55
+ let dependency = "forge-std~1.8.1" ;
56
+ let git =
"[email protected] :mario4582928/Mario.git" ;
57
+
58
+ let foundry_file = prj. root( ) . join( "foundry.toml" ) ;
59
+
60
+ cmd. arg( "soldeer" ) . args( [ command, dependency, git] ) ;
61
+ cmd. execute( ) ;
62
+
63
+ // Making sure the path was created to the dependency and that README.md exists
64
+ // meaning that the dependencies were installed correctly
65
+ let path_dep_forge = prj. root( ) . join( "dependencies" ) . join( "forge-std-1.8.1" ) . join( "README.md" ) ;
66
+ assert!( path_dep_forge. exists( ) ) ;
67
+
68
+ // Making sure the lock contents are the right ones
69
+ let path_lock_file = prj. root( ) . join( "soldeer.lock" ) ;
70
+ let lock_contents = r#"
71
+ [[dependencies]]
72
+ name = "forge-std"
73
+ version = "1.8.1"
74
+ source = "[email protected] :mario4582928/Mario.git"
75
+ checksum = "22868f426bd4dd0e682b5ec5f9bd55507664240c"
76
+ "# ;
77
+
78
+ let actual_lock_contents = read_file_to_string( & path_lock_file) ;
79
+ assert_eq!( lock_contents, actual_lock_contents) ;
80
+
81
+ // Making sure the foundry contents are the right ones
82
+ let foundry_contents = r#"[profile.default]
83
+ src = "src"
84
+ out = "out"
85
+ libs = ["lib"]
86
+
87
+ # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
88
+
89
+ [dependencies]
90
+ forge-std = { version = "1.8.1", git = "[email protected] :mario4582928/Mario.git", rev = "22868f426bd4dd0e682b5ec5f9bd55507664240c" }
91
+ "# ;
92
+
93
+ assert_data_eq!( read_file_to_string( & foundry_file) , foundry_contents) ;
94
+ } ) ;
95
+
96
+ forgesoldeer ! ( install_dependency_git_commit, |prj, cmd| {
97
+ let command = "install" ;
98
+ let dependency = "forge-std~1.8.1" ;
99
+ let git =
"[email protected] :mario4582928/Mario.git" ;
100
+ let rev_flag = "--rev" ;
101
+ let commit = "7a0663eaf7488732f39550be655bad6694974cb3" ;
102
+
103
+ let foundry_file = prj. root( ) . join( "foundry.toml" ) ;
104
+
105
+ cmd. arg( "soldeer" ) . args( [ command, dependency, git, rev_flag, commit] ) ;
106
+ cmd. execute( ) ;
107
+
108
+ // Making sure the path was created to the dependency and that README.md exists
109
+ // meaning that the dependencies were installed correctly
110
+ let path_dep_forge =
111
+ prj. root( ) . join( "dependencies" ) . join( "forge-std-1.8.1" ) . join( "JustATest2.md" ) ;
112
+ assert!( path_dep_forge. exists( ) ) ;
113
+
114
+ // Making sure the lock contents are the right ones
115
+ let path_lock_file = prj. root( ) . join( "soldeer.lock" ) ;
116
+ let lock_contents = r#"
117
+ [[dependencies]]
118
+ name = "forge-std"
119
+ version = "1.8.1"
120
+ source = "[email protected] :mario4582928/Mario.git"
121
+ checksum = "7a0663eaf7488732f39550be655bad6694974cb3"
122
+ "# ;
123
+
124
+ let actual_lock_contents = read_file_to_string( & path_lock_file) ;
125
+ assert_eq!( lock_contents, actual_lock_contents) ;
126
+
127
+ // Making sure the foundry contents are the right ones
128
+ let foundry_contents = r#"[profile.default]
129
+ src = "src"
130
+ out = "out"
131
+ libs = ["lib"]
132
+
133
+ # See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
134
+
135
+ [dependencies]
136
+ forge-std = { version = "1.8.1", git = "[email protected] :mario4582928/Mario.git", rev = "7a0663eaf7488732f39550be655bad6694974cb3" }
137
+ "# ;
138
+
139
+ assert_data_eq!( read_file_to_string( & foundry_file) , foundry_contents) ;
52
140
} ) ;
53
141
54
142
forgesoldeer ! ( update_dependencies, |prj, cmd| {
@@ -101,8 +189,7 @@ libs = ["lib"]
101
189
forge-std = { version = "1.8.1" }
102
190
"# ;
103
191
104
- let actual_foundry_contents = read_file_to_string( & foundry_file) ;
105
- assert_eq!( foundry_contents, actual_foundry_contents) ;
192
+ assert_data_eq!( read_file_to_string( & foundry_file) , foundry_contents) ;
106
193
} ) ;
107
194
108
195
forgesoldeer ! ( update_dependencies_simple_version, |prj, cmd| {
@@ -156,8 +243,7 @@ libs = ["lib"]
156
243
forge-std = "1.8.1"
157
244
"# ;
158
245
159
- let actual_foundry_contents = read_file_to_string( & foundry_file) ;
160
- assert_eq!( foundry_contents, actual_foundry_contents) ;
246
+ assert_data_eq!( read_file_to_string( & foundry_file) , foundry_contents) ;
161
247
} ) ;
162
248
163
249
forgesoldeer ! ( login, |prj, cmd| {
0 commit comments