File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
crates/ark/src/lsp/inputs Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -29,10 +29,7 @@ impl Index {
2929
3030 let index_path = path. join ( "INDEX" ) ;
3131 if !index_path. is_file ( ) {
32- return Err ( anyhow:: anyhow!(
33- "Can't load index as '{path}' does not contain an INDEX file" ,
34- path = path. to_string_lossy( )
35- ) ) ;
32+ return Ok ( Self :: default ( ) ) ;
3633 }
3734
3835 let contents = std:: fs:: read_to_string ( & index_path) ?;
@@ -148,16 +145,17 @@ Nelder_Mead Nelder-Mead Optimization of Parameters,
148145 }
149146
150147 #[ test]
151- fn load_from_folder_returns_errors ( ) {
152- // From a file
148+ fn load_from_folder_returns_error_for_file ( ) {
153149 let file = tempfile:: NamedTempFile :: new ( ) . unwrap ( ) ;
154150 let result = Index :: load_from_folder ( file. path ( ) ) ;
155151 assert ! ( result. is_err( ) ) ;
152+ }
156153
157- // From a dir without an INDEX file
154+ #[ test]
155+ fn load_from_folder_returns_default_without_index ( ) {
158156 let dir = tempdir ( ) . unwrap ( ) ;
159- let result = Index :: load_from_folder ( dir. path ( ) ) ;
160- assert ! ( result . is_err ( ) ) ;
157+ let idx = Index :: load_from_folder ( dir. path ( ) ) . unwrap ( ) ;
158+ assert ! ( idx . names . is_empty ( ) ) ;
161159 }
162160
163161 #[ test]
You can’t perform that action at this time.
0 commit comments