@@ -133,19 +133,25 @@ fn check_info_file_exercises(info_file: &InfoFile) -> Result<HashSet<PathBuf>> {
133133
134134 file_buf. clear ( ) ;
135135
136- paths. insert ( PathBuf :: from ( path) ) ;
136+ let path = PathBuf :: from ( path) ;
137+
138+ for input_file in & exercise_info. input_files {
139+ paths. insert ( path. parent ( ) . unwrap ( ) . join ( input_file) ) ;
140+ }
141+
142+ paths. insert ( path) ;
137143 }
138144
139145 Ok ( paths)
140146}
141147
142148// Check `dir` for unexpected files.
143- // Only Rust files in `allowed_rust_files ` and `README.md` files are allowed.
149+ // Only files in `allowed_files ` and `README.md` files are allowed.
144150// Only one level of directory nesting is allowed.
145- fn check_unexpected_files ( dir : & str , allowed_rust_files : & HashSet < PathBuf > ) -> Result < ( ) > {
151+ fn check_unexpected_files ( dir : & str , allowed_files : & HashSet < PathBuf > ) -> Result < ( ) > {
146152 let unexpected_file = |path : & Path | {
147153 anyhow ! (
148- "Found the file `{}`. Only `README.md` and Rust files related to an exercise in `info.toml` are allowed in the `{dir}` directory" ,
154+ "Found the file `{}`. Only `README.md`, Rust files and input files related to an exercise in `info.toml` are allowed in the `{dir}` directory" ,
149155 path. display( )
150156 )
151157 } ;
@@ -160,7 +166,7 @@ fn check_unexpected_files(dir: &str, allowed_rust_files: &HashSet<PathBuf>) -> R
160166 continue ;
161167 }
162168
163- if !allowed_rust_files . contains ( & path) {
169+ if !allowed_files . contains ( & path) {
164170 return Err ( unexpected_file ( & path) ) ;
165171 }
166172
@@ -187,7 +193,7 @@ fn check_unexpected_files(dir: &str, allowed_rust_files: &HashSet<PathBuf>) -> R
187193 continue ;
188194 }
189195
190- if !allowed_rust_files . contains ( & path) {
196+ if !allowed_files . contains ( & path) {
191197 return Err ( unexpected_file ( & path) ) ;
192198 }
193199 }
0 commit comments