Skip to content

Enable asserts when testing pub #2754

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 5 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/src/entrypoint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ class Entrypoint {
// Check if language version specified in the `package_config.json` is
// correct. This is important for path dependencies as these can mutate.
for (final pkg in cfg.packages) {
if (pkg.name == root.name || pkg.name == 'flutter_gen') continue;
final id = lockFile.packages[pkg.name];
if (id == null) {
assert(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/null_safety_analysis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class NullSafetyAnalysis {
.createContext(
sdkPath: getSdkPath(),
contextRoot: ContextLocator().locateRoots(
includedPaths: [packageDir],
includedPaths: [path.normalize(packageDir)],
).first,
)
.currentSession;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/solver/failure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class SolveFailure implements ApplicationException {
}

SolveFailure(this.incompatibility)
: assert(incompatibility.terms.single.package.isRoot);
: assert(incompatibility.terms.isEmpty ||
incompatibility.terms.single.package.isRoot);

/// Describes how [incompatibility] was derived, and thus why version solving
/// failed.
Expand Down
2 changes: 1 addition & 1 deletion test/test_pub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ Future<PubProcess> startPub(

final dotPackagesPath = (await Isolate.packageConfig).toString();

var dartArgs = ['--packages=$dotPackagesPath'];
var dartArgs = ['--packages=$dotPackagesPath', '--enable-asserts'];
dartArgs..addAll([pubPath, if (verbose) '--verbose'])..addAll(args);

return await PubProcess.start(dartBin, dartArgs,
Expand Down