Skip to content

Factor out a SuiteConfiguration object. #492

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

Merged
merged 2 commits into from
Nov 17, 2016
Merged

Factor out a SuiteConfiguration object. #492

merged 2 commits into from
Nov 17, 2016

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Nov 16, 2016

This tracks configuration that makes sense to apply to test suites, as
opposed to Configuration which applies to an entire run and Metadata
which applies to individual tests. This is intended to make it easier
for load separate configurations for separate targets in a live test
runner.

@goderbauer

This tracks configuration that makes sense to apply to test suites, as
opposed to Configuration which applies to an entire run and Metadata
which applies to individual tests. This is intended to make it easier
for load separate configurations for separate targets in a live test
runner.
Copy link
Contributor

@jmesserly jmesserly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍


var newPresets = new Map<String, Configuration>.from(presets);
var merged = chosenPresets.fold(empty, (merged, preset) {
if (!newPresets.containsKey(preset)) return merged;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if null isn't possible in presets, then you can combine these two operations in one dictionary lookup:

var newPreset = newPresets.remove(preset);
return newPreset != null ? merged.merge(newPreset) : merged;

https://api.dartlang.org/stable/1.20.1/dart-core/Map/remove.html

whether it's worth a small tweak like that, not sure. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All small tweaks are worth it if they're good. I can even make it cleaner, since Configuration.merge(Configuration.empty) is a no-op. Done.

@nex3 nex3 merged commit c4370e3 into master Nov 17, 2016
@nex3 nex3 deleted the configuration branch November 17, 2016 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants