(t *testing.T)
| 492 | } |
| 493 | |
| 494 | func TestBridgeClassConstructorIdentityRegistrationFailure(t *testing.T) { |
| 495 | rt := NewRuntime() |
| 496 | defer rt.Close() |
| 497 | ctx := rt.NewContext() |
| 498 | defer ctx.Close() |
| 499 | |
| 500 | backupContextID := ctx.contextID |
| 501 | |
| 502 | constructor, _ := NewClassBuilder("IdentityRegistrationFailureClass"). |
| 503 | Constructor(func(ctx *Context, instance *Value, args []*Value) (interface{}, error) { |
| 504 | ctx.contextID = 0 |
| 505 | return map[string]int{"x": 1}, nil |
| 506 | }). |
| 507 | Build(ctx) |
| 508 | require.False(t, constructor.IsException()) |
| 509 | |
| 510 | ctx.Globals().Set("IdentityRegistrationFailureClass", constructor) |
| 511 | |
| 512 | result := ctx.Eval(`new IdentityRegistrationFailureClass()`) |
| 513 | ctx.contextID = backupContextID |
| 514 | |
| 515 | defer result.Free() |
| 516 | require.True(t, result.IsException()) |
| 517 | err := ctx.Exception() |
| 518 | require.Error(t, err) |
| 519 | require.Contains(t, err.Error(), "Failed to register class object identity") |
| 520 | } |
| 521 | |
| 522 | func TestBridgeClassFinalizerProxyContracts(t *testing.T) { |
| 523 | rt := NewRuntime() |
nothing calls this directly
no test coverage detected