dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.27k stars 4.73k forks source link

Need tests for dynamic operations not used by C# compiler #19482

Open JonHanna opened 7 years ago

JonHanna commented 7 years ago

Tests are currently being added for a lot of the DLR-supporting classes. For obvious enough reasons, these use C# dynamic. This doesn't test capabilities C# doesn't make use of, such as case-insensitive binding, dynamic object creation and dynamic deletion. These features should be tested. If anything they could be all the more likely to suffer a regression without triggering an error somewhere because C# doesn't use them.

Possible approaches:

  1. Supplementary test project in other language(s).
  2. Custom binding implementation that uses the approaches to test.
  3. ???
JonHanna commented 7 years ago

@hughbe any ideas? You added quite a few expression tests for things that can't be done with plain C#, though I think this goes a bit beyond that.

hughbe commented 7 years ago

Interesting - im not sure having another language is the best choice as inevitably that language won't have all the features and then we need to write tests another language and then soon it becomes a mess of tests. the custom binder implementation might be more effort but kind of aligns with dependency injection test approaches. Since it is language independent and can be put into the same project as the existing tests I would go with that.

As per other options, none come to my mind atm but I'll let you know if I think of anything

JonHanna commented 7 years ago

I think a custom binder is probably going to be necessary. It's perhaps possible that some cases would be low-lying fruit to another language and reduce what the custom binder needs to cover, e.g. a case-insensitive language should make covering all of those pretty fast to do, though I really haven't much experience in any except C# and CIL myself so I'd maybe have a custom binder nearly finished in the same time I got hello world going in another.