@@ -2,7 +2,7 @@ package openapi3
22
33import (
44 "context"
5- "io/ioutil "
5+ "os "
66 "regexp"
77 "testing"
88
@@ -41,25 +41,25 @@ func TestInternalizeRefs(t *testing.T) {
4141 err = doc .Validate (ctx )
4242 require .NoError (t , err , "validating internalized spec" )
4343
44- data , err := doc .MarshalJSON ()
44+ actual , err := doc .MarshalJSON ()
4545 require .NoError (t , err , "marshalling internalized spec" )
4646
4747 // run a static check over the file, making sure each occurence of a
4848 // reference is followed by a #
49- numRefs := len (regexpRef .FindAll (data , - 1 ))
50- numInternalRefs := len (regexpRefInternal .FindAll (data , - 1 ))
49+ numRefs := len (regexpRef .FindAll (actual , - 1 ))
50+ numInternalRefs := len (regexpRefInternal .FindAll (actual , - 1 ))
5151 require .Equal (t , numRefs , numInternalRefs , "checking all references are internal" )
5252
53- // load from data , but with the path set to the current directory
54- doc2 , err := sl .LoadFromData (data )
53+ // load from actual , but with the path set to the current directory
54+ doc2 , err := sl .LoadFromData (actual )
5555 require .NoError (t , err , "reloading spec" )
5656 err = doc2 .Validate (ctx )
5757 require .NoError (t , err , "validating reloaded spec" )
5858
5959 // compare with expected
60- data0 , err := ioutil .ReadFile (test .filename + ".internalized.yml" )
60+ expected , err := os .ReadFile (test .filename + ".internalized.yml" )
6161 require .NoError (t , err )
62- require .JSONEq (t , string (data ), string (data0 ))
62+ require .JSONEq (t , string (expected ), string (actual ))
6363 })
6464 }
6565}
0 commit comments