File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ impl Metadata {
132132 }
133133
134134 fn try_from_solidity ( path : & Path ) -> Option < Self > {
135- let buf = read_to_string ( path)
135+ let spec = read_to_string ( path)
136136 . inspect_err ( |error| {
137137 log:: error!(
138138 "opening JSON test metadata file '{}' error: {error}" ,
@@ -147,18 +147,24 @@ impl Metadata {
147147 buf
148148 } ) ;
149149
150- if buf . is_empty ( ) {
150+ if spec . is_empty ( ) {
151151 return None ;
152152 }
153153
154- match serde_json:: from_str :: < Self > ( & buf ) {
154+ match serde_json:: from_str :: < Self > ( & spec ) {
155155 Ok ( mut metadata) => {
156156 metadata. file_path = Some ( path. to_path_buf ( ) ) ;
157+ let name = path
158+ . file_name ( )
159+ . expect ( "this should be the path to a Solidity file" )
160+ . to_str ( )
161+ . expect ( "the file name should be valid UTF-8k" ) ;
162+ metadata. contracts = Some ( [ ( String :: from ( "Test" ) , format ! ( "{name}:Test" ) ) ] . into ( ) ) ;
157163 Some ( metadata)
158164 }
159165 Err ( error) => {
160166 log:: error!(
161- "parsing Solidity test metadata file '{}' error: {error}" ,
167+ "parsing Solidity test metadata file '{}' error: ' {error}' from data: {spec }" ,
162168 path. display( )
163169 ) ;
164170 None
You can’t perform that action at this time.
0 commit comments