@@ -1270,47 +1270,53 @@ func TestTypedFunctions(t *testing.T) {
12701270 }
12711271
12721272 _ , err = script .Call (context .Background (), "pick_second" , []Value {NewString ("bad" ), NewInt (2 )}, CallOptions {})
1273- if err == nil || ! strings .Contains (err .Error (), "expected int" ) {
1274- t .Fatalf ("expected type error, got %v" , err )
1273+ if err == nil ||
1274+ ! strings .Contains (err .Error (), "argument n expected int, got string" ) {
1275+ t .Fatalf ("expected argument type error, got %v" , err )
12751276 }
12761277
12771278 _ , err = script .Call (context .Background (), "bad_return" , []Value {NewInt (1 )}, CallOptions {})
12781279 if err == nil {
12791280 res , _ := script .Call (context .Background (), "bad_return" , []Value {NewInt (1 )}, CallOptions {})
12801281 t .Fatalf ("expected return type error, got value %v (%v)" , res , res .Kind ())
12811282 }
1282- if ! strings .Contains (err .Error (), "expected int" ) {
1283+ if ! strings .Contains (err .Error (), "return value for bad_return expected int, got string " ) {
12831284 t .Fatalf ("expected return type error, got %v" , err )
12841285 }
12851286
12861287 _ , err = script .Call (context .Background (), "union_echo" , []Value {NewBool (true )}, CallOptions {})
1287- if err == nil || ! strings .Contains (err .Error (), "expected int | string" ) {
1288+ if err == nil ||
1289+ ! strings .Contains (err .Error (), "argument v expected int | string, got bool" ) {
12881290 t .Fatalf ("expected union arg type error, got %v" , err )
12891291 }
12901292
12911293 _ , err = script .Call (context .Background (), "union_bad_return" , nil , CallOptions {})
1292- if err == nil || ! strings .Contains (err .Error (), "expected int | string" ) {
1294+ if err == nil ||
1295+ ! strings .Contains (err .Error (), "return value for union_bad_return expected int | string, got bool" ) {
12931296 t .Fatalf ("expected union return type error, got %v" , err )
12941297 }
12951298
12961299 _ , err = script .Call (context .Background (), "ints_only" , []Value {
12971300 NewArray ([]Value {NewInt (1 ), NewString ("oops" )}),
12981301 }, CallOptions {})
1299- if err == nil || ! strings .Contains (err .Error (), "expected array<int>" ) {
1302+ if err == nil ||
1303+ ! strings .Contains (err .Error (), "argument values expected array<int>, got array" ) {
13001304 t .Fatalf ("expected typed array arg error, got %v" , err )
13011305 }
13021306
13031307 _ , err = script .Call (context .Background (), "totals_by_player" , []Value {
13041308 NewHash (map [string ]Value {"alice" : NewString ("oops" )}),
13051309 }, CallOptions {})
1306- if err == nil || ! strings .Contains (err .Error (), "expected hash<string, int>" ) {
1310+ if err == nil ||
1311+ ! strings .Contains (err .Error (), "argument totals expected hash<string, int>, got hash" ) {
13071312 t .Fatalf ("expected typed hash arg error, got %v" , err )
13081313 }
13091314
13101315 _ , err = script .Call (context .Background (), "mixed_items" , []Value {
13111316 NewArray ([]Value {NewBool (true )}),
13121317 }, CallOptions {})
1313- if err == nil || ! strings .Contains (err .Error (), "expected array<int | string>" ) {
1318+ if err == nil ||
1319+ ! strings .Contains (err .Error (), "argument values expected array<int | string>, got array" ) {
13141320 t .Fatalf ("expected typed union array arg error, got %v" , err )
13151321 }
13161322
@@ -1321,7 +1327,8 @@ func TestTypedFunctions(t *testing.T) {
13211327 "role" : NewString ("captain" ),
13221328 }),
13231329 }, CallOptions {})
1324- if err == nil || ! strings .Contains (err .Error (), "expected { active: bool?, id: string, score: int }" ) {
1330+ if err == nil ||
1331+ ! strings .Contains (err .Error (), "argument payload expected { active: bool?, id: string, score: int }, got hash" ) {
13251332 t .Fatalf ("expected shape extra-field error, got %v" , err )
13261333 }
13271334
@@ -1332,7 +1339,8 @@ func TestTypedFunctions(t *testing.T) {
13321339 "active" : NewBool (true ),
13331340 }),
13341341 }, CallOptions {})
1335- if err == nil || ! strings .Contains (err .Error (), "expected { active: bool?, id: string, score: int }" ) {
1342+ if err == nil ||
1343+ ! strings .Contains (err .Error (), "argument payload expected { active: bool?, id: string, score: int }, got hash" ) {
13361344 t .Fatalf ("expected shape field-type error, got %v" , err )
13371345 }
13381346
@@ -1346,7 +1354,8 @@ func TestTypedFunctions(t *testing.T) {
13461354 }),
13471355 }),
13481356 }, CallOptions {})
1349- if err == nil || ! strings .Contains (err .Error (), "expected array<{ id: string, stats: { wins: int } }>" ) {
1357+ if err == nil ||
1358+ ! strings .Contains (err .Error (), "argument rows expected array<{ id: string, stats: { wins: int } }>, got array" ) {
13501359 t .Fatalf ("expected nested shape error, got %v" , err )
13511360 }
13521361}
0 commit comments