(t *testing.T)
| 364 | } |
| 365 | |
| 366 | func TestReflectionWithMethodPrefix(t *testing.T) { |
| 367 | rt := NewRuntime() |
| 368 | defer rt.Close() |
| 369 | ctx := rt.NewContext() |
| 370 | defer ctx.Close() |
| 371 | |
| 372 | // Test method prefix filtering |
| 373 | builder, err := ctx.BindClassBuilder(&FilteredMethods{}, WithMethodPrefix("Get")) |
| 374 | require.NoError(t, err) |
| 375 | |
| 376 | constructor, _ := builder.Build(ctx) |
| 377 | require.False(t, constructor.IsException()) |
| 378 | |
| 379 | ctx.Globals().Set("Filtered", constructor) |
| 380 | |
| 381 | result := ctx.Eval(` |
| 382 | let obj = new Filtered(); |
| 383 | [ |
| 384 | typeof obj.GetData, // Should exist |
| 385 | typeof obj.GetInfo, // Should exist |
| 386 | typeof obj.SetData, // Should be undefined (no Get prefix) |
| 387 | typeof obj.ProcessData // Should be undefined (no Get prefix) |
| 388 | ]; |
| 389 | `) |
| 390 | defer result.Free() |
| 391 | |
| 392 | require.False(t, result.IsException()) |
| 393 | |
| 394 | require.Equal(t, "function", result.GetIdx(0).ToString()) // Changed: String() → ToString() |
| 395 | require.Equal(t, "function", result.GetIdx(1).ToString()) // Changed: String() → ToString() |
| 396 | require.Equal(t, "undefined", result.GetIdx(2).ToString()) // Changed: String() → ToString() |
| 397 | require.Equal(t, "undefined", result.GetIdx(3).ToString()) // Changed: String() → ToString() |
| 398 | } |
| 399 | |
| 400 | func TestReflectionWithIgnoredMethods(t *testing.T) { |
| 401 | rt := NewRuntime() |
nothing calls this directly
no test coverage detected