Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad @MirrorsUsed annotation in tests/isolate/remote_unittest_helper.dart #15443

Open
peter-ahe-google opened this issue Dec 4, 2013 · 3 comments
Assignees
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@peter-ahe-google
Copy link
Contributor

tests/isolate/remote_unittest_helper.dart:12:40: Hint: Can't find 'main' in the current library.
Did you forget to add an import?
@MirrorsUsed(symbols: "main", targets: "main", override: "*")
                                       ^^^^^^
Dart file (tests/isolate/nested_spawn_test.dart) compiled to JavaScript: out.js

Also, why are you importing unittest? Is there something wrong with pkg/async_helper?

@lrhn
Copy link
Member

lrhn commented Dec 4, 2013

This is intended say that I'll be using mirrors of the "main" method of a different library. Any alternative way of stating that is welcome.

I'm importing unittest because I change the unittest configuration before running the tests in the main method that is passed as an argument.

I'm sure there is something wrong with async_helper (this is software!), but I have no idea what.

@peter-ahe-google
Copy link
Contributor Author

You can write the qualified name of the main method.

But I suspect that you don't know what the name of that method is.

You should not use mirrors, @­MirrorsUsed, and pkg/unittest to test isolates. What you're doing is piling on complexity where it doesn't belong. In addition, dart:mirrors is unstable API which also makes it an inappropriate choice for testing core platform features. The alternative is to remove the dependency on unittest. There is a simple alternative in tests/lib/mirrors.

@lrhn
Copy link
Member

lrhn commented Dec 5, 2013

In this case, I'm using mirrors only to get the URL of the library that contains the test that needs to be run in a different isolate.
I guess I could hardcode that in each test. It'll be more fragile, but breaking would be quickly detected, so it's probably not a problem.

The tests were already written using unittest, some of them with multiple test cases, but I guess I can rewrite them to using package:expect and package:async_helper.

@peter-ahe-google peter-ahe-google added Type-Defect area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). labels Dec 5, 2013
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed priority-unassigned labels Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Cross-cutting test issues (use area- labels for specific failures; not used for package:test). type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants