(t *testing.T)
| 398 | } |
| 399 | |
| 400 | func TestReflectionWithIgnoredMethods(t *testing.T) { |
| 401 | rt := NewRuntime() |
| 402 | defer rt.Close() |
| 403 | ctx := rt.NewContext() |
| 404 | defer ctx.Close() |
| 405 | |
| 406 | // Test ignored methods |
| 407 | builder, err := ctx.BindClassBuilder(&FilteredMethods{}, WithIgnoredMethods("GetInfo", "ProcessData")) |
| 408 | require.NoError(t, err) |
| 409 | |
| 410 | constructor, _ := builder.Build(ctx) |
| 411 | require.False(t, constructor.IsException()) |
| 412 | |
| 413 | ctx.Globals().Set("Filtered", constructor) |
| 414 | |
| 415 | result := ctx.Eval(` |
| 416 | let obj = new Filtered(); |
| 417 | [ |
| 418 | typeof obj.GetData, // Should exist |
| 419 | typeof obj.GetInfo, // Should be undefined (ignored) |
| 420 | typeof obj.SetData, // Should exist |
| 421 | typeof obj.ProcessData // Should be undefined (ignored) |
| 422 | ]; |
| 423 | `) |
| 424 | defer result.Free() |
| 425 | |
| 426 | require.False(t, result.IsException()) |
| 427 | |
| 428 | require.Equal(t, "function", result.GetIdx(0).ToString()) // Changed: String() → ToString() |
| 429 | require.Equal(t, "undefined", result.GetIdx(1).ToString()) // Changed: String() → ToString() |
| 430 | require.Equal(t, "function", result.GetIdx(2).ToString()) // Changed: String() → ToString() |
| 431 | require.Equal(t, "undefined", result.GetIdx(3).ToString()) // Changed: String() → ToString() |
| 432 | } |
| 433 | |
| 434 | // ============================================================================= |
| 435 | // ERROR HANDLING TESTS |
nothing calls this directly
no test coverage detected