-
Notifications
You must be signed in to change notification settings - Fork 28
Need tests to work even with different defaultValue
default values
#585
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
Comments
Fixed in both branches |
Oops, please revert this and make the change as described in #540. It turns out that we have very few tests where we test that the default value for But if it says Also note that the default values are the same both in |
I didn't rever but did the changes for #540 above this. Protection for the case when the system has an environment variable used in the test was left |
Sounds good! The important bit is that it should fail if the default value of |
[Coming back after a meeting, edited this whole comment.] I can see that the new version of the test computes var s1 = const String.fromEnvironment('SOME_ENV_VARIABLE', defaultValue: 'No');
Expect.equals('No', s1);
var s2 = const String.fromEnvironment('SOME_ENV_VARIABLE');
Expect.equals('', s2); (I fixed the The current form does not do that, because it uses The reason why this is important is that we have very few tests that actually test the default values of Yes, I know: I asked for a rewrite of the kind that makes the test independent of these default values, but that was before I detected how tiny our test coverage is for the actual values. |
No problem. Changed in both branches |
The test 'LibTest/core/String/String.fromEnvironment_A01_t01.dart' needs to be adjusted such that it will continue to work independently of the default value specified for
defaultValue
. So we need this:Note that it should use
const
rather thannew
: The documentation of these constructors indicates that it is a dynamic error to invoke them at run time (so they can only be used in constant expressions). This is not implemented by all tools, but it is more important to make this test test something that should actually work, and then we may put a TODO somewhere to decide on whether to insist that thenew
usage should cause an exception, and write a separate test for that.The test 'LibTest/core/int/int.fromEnvironment_A01_t01.dart' needs a corresponding update.
These changes need to be performed in both the master and the pre-nnbd branch, because the default values for
defaultValue
will be changed in both SDKs.The text was updated successfully, but these errors were encountered: