anchor.diff:      await expectResolves(result: {'foo': '2.0.0', 'bar': '2.0.0'}, tries: 3);
     });
   
  -  test('root package allows 2.0.0-dev by default', () async {
  -    await d.dir(appPath, [
  -      await d.pubspec({'name': 'myapp'})
  -    ]).create();
  -
  -    await expectResolves(
  -        environment: {'_PUB_TEST_SDK_VERSION': '2.0.0-dev.99'});
  -  });
  -
  -  test('root package allows 2.0.0 by default', () async {
  -    await d.dir(appPath, [
  -      await d.pubspec({'name': 'myapp'})
  -    ]).create();
  -
  -    await expectResolves(environment: {'_PUB_TEST_SDK_VERSION': '2.0.0'});
  -  });
  -
  -  test('package deps allow 2.0.0-dev by default', () async {
  -    await d.dir('foo', [
  -      await d.pubspec({'name': 'foo'})
  -    ]).create();
  -    await d.dir('bar', [
  -      await d.pubspec({'name': 'bar'})
  -    ]).create();
  -
  -    await d.dir(appPath, [
  -      await d.pubspec({
  -        'name': 'myapp',
  -        'dependencies': {
  -          'foo': {'path': '../foo'},
  -          'bar': {'path': '../bar'},
  -        }
  -      })
  -    ]).create();
  -
  -    await expectResolves(
  -      environment: {'_PUB_TEST_SDK_VERSION': '2.0.0-dev.99'},
  -      // Log output should mention the PUB_ALLOW_RELEASE_SDK environment
  -      // variable and mention the foo and bar packages specifically.
  -      output: allOf(
  -          contains('PUB_ALLOW_PRERELEASE_SDK'), anyOf(contains('bar, foo'))),
  -    );
  -  });
  -
  -  test(
  -      "pub doesn't log about pre-release SDK overrides if "
  -      "PUB_ALLOW_PRERELEASE_SDK=quiet", () async {
  -    await d.dir('foo', [
  -      await d.pubspec({'name': 'foo'})
  -    ]).create();
  -
  -    await d.dir(appPath, [
  -      await d.pubspec({
  -        'name': 'myapp',
  -        'dependencies': {
  -          'foo': {'path': '../foo'},
  -        }
  -      })
  -    ]).create();
  -
  -    await expectResolves(
  -      environment: {
  -        '_PUB_TEST_SDK_VERSION': '2.0.0-dev.99',
  -        'PUB_ALLOW_PRERELEASE_SDK': 'quiet'
  -      },
  -      // Log output should not mention the PUB_ALLOW_RELEASE_SDK environment
  -      // variable.
  -      output: isNot(contains('PUB_ALLOW_PRERELEASE_SDK')),
  -    );
  -  });
  -
  -  test('package deps disallow 2.0.0-dev if PUB_ALLOW_PRERELEASE_SDK is false',
  -      () async {
  -    await d.dir('foo', [
  -      await d.pubspec({'name': 'foo'})
  -    ]).create();
  -
  -    await d.dir(appPath, [
  -      await d.pubspec({
  -        'name': 'myapp',
  -        'dependencies': {
  -          'foo': {'path': '../foo'}
  -        }
  -      })
  -    ]).create();
  -
  -    await expectResolves(
  +  group('pre-release overrides', () {
  +    group('for the root package', () {
  +      test('allow 2.0.0-dev by default', () async {
  +        await d.dir(appPath, [
  +          await d.pubspec({'name': 'myapp'})
  +        ]).create();
  +
  +        await expectResolves(
  +            environment: {'_PUB_TEST_SDK_VERSION': '2.0.0-dev.99'});
  +      });
  +
  +      test('allow 2.0.0 by default', () async {
  +        await d.dir(appPath, [
  +          await d.pubspec({'name': 'myapp'})
  +        ]).create();
  +
  +        await expectResolves(environment: {'_PUB_TEST_SDK_VERSION': '2.0.0'});
  +      });
  +
  +      test("allow pre-release versions of the upper bound", () async {
  +        await d.dir(appPath, [
  +          await d.pubspec({
  +            'name': 'myapp',
  +            'environment': {'sdk': '<1.2.3'}
  +          })
  +        ]).create();
  +
  +        await expectResolves(
  +            environment: {'_PUB_TEST_SDK_VERSION': '1.2.3-dev.1.0'},
  +            output: allOf(contains('PUB_ALLOW_PRERELEASE_SDK'),
  +                contains('<=1.2.3-dev.1.0'), contains('myapp')));
  +      });
  +    });
  +
  +    group('for a dependency', () {
  +      test('disallow 2.0.0 by default', () async {
  +        await d.dir('foo', [
  +          await d.pubspec({'name': 'foo'})
  +        ]).create();
  +
  +        await d.dir(appPath, [
  +          await d.pubspec({
  +            'name': 'myapp',
  +            'dependencies': {
  +              'foo': {'path': '../foo'}
  +            }
  +          })
  +        ]).create();
  +
  +        await expectResolves(
  +            environment: {'_PUB_TEST_SDK_VERSION': '2.0.0'},
  +            error: equalsIgnoringWhitespace('''
  +          The current Dart SDK version is 2.0.0.
  +
  +          Because myapp depends on foo from path which requires SDK version
  +            <2.0.0, version solving failed.
  +        '''));
  +      });
  +
  +      test('allow 2.0.0-dev by default', () async {
  +        await d.dir('foo', [
  +          await d.pubspec({'name': 'foo'})
  +        ]).create();
  +        await d.dir('bar', [
  +          await d.pubspec({'name': 'bar'})
  +        ]).create();
  +
  +        await d.dir(appPath, [
  +          await d.pubspec({
  +            'name': 'myapp',
  +            'dependencies': {
  +              'foo': {'path': '../foo'},
  +              'bar': {'path': '../bar'},
  +            }
  +          })
  +        ]).create();
  +
  +        await expectResolves(
  +          environment: {'_PUB_TEST_SDK_VERSION': '2.0.0-dev.99'},
  +          // Log output should mention the PUB_ALLOW_RELEASE_SDK environment
  +          // variable and mention the foo and bar packages specifically.
  +          output: allOf(contains('PUB_ALLOW_PRERELEASE_SDK'),
  +              anyOf(contains('bar, foo'))),
  +        );
  +      });
  +    });
  +
  +    test("don't log if PUB_ALLOW_PRERELEASE_SDK is quiet", () async {
  +      await d.dir('foo', [
  +        await d.pubspec({'name': 'foo'})
  +      ]).create();
  +
  +      await d.dir(appPath, [
  +        await d.pubspec({
  +          'name': 'myapp',
  +          'dependencies': {
  +            'foo': {'path': '../foo'},
  +          }
  +        })
  +      ]).create();
  +
  +      await expectResolves(
           environment: {
             '_PUB_TEST_SDK_VERSION': '2.0.0-dev.99',
  -          'PUB_ALLOW_PRERELEASE_SDK': 'false'
  +          'PUB_ALLOW_PRERELEASE_SDK': 'quiet'
           },
  -        error: 'Package foo requires SDK version <2.0.0 but the '
  -            'current SDK is 2.0.0-dev.99.');
  -  });
  -
  -  test('package deps disallow 2.0.0 by default', () async {
  -    await d.dir('foo', [
  -      await d.pubspec({'name': 'foo'})
  -    ]).create();
  -
  -    await d.dir(appPath, [
  -      await d.pubspec({
  -        'name': 'myapp',
  -        'dependencies': {
  -          'foo': {'path': '../foo'}
  -        }
  -      })
  -    ]).create();
  -
  -    await expectResolves(
  -        environment: {'_PUB_TEST_SDK_VERSION': '2.0.0'},
  -        error: 'Package foo requires SDK version <2.0.0 but the '
  -            'current SDK is 2.0.0.');
  -  });
  -
  -  group("pre-release override", () {
  -    group("requires", () {
  -      test("major SDK versions to match", () async {
  +        // Log output should not mention the PUB_ALLOW_RELEASE_SDK environment
  +        // variable.
  +        output: isNot(contains('PUB_ALLOW_PRERELEASE_SDK')),
  +      );
  +    });
  +
  +    test('are disabled if PUB_ALLOW_PRERELEASE_SDK is false', () async {
  +      await d.dir('foo', [
  +        await d.pubspec({'name': 'foo'})
  +      ]).create();
  +
  +      await d.dir(appPath, [
  +        await d.pubspec({
  +          'name': 'myapp',
  +          'dependencies': {
  +            'foo': {'path': '../foo'}
  +          }
  +        })
  +      ]).create();
  +
  +      await expectResolves(
  +          environment: {
  +            '_PUB_TEST_SDK_VERSION': '2.0.0-dev.99',
  +            'PUB_ALLOW_PRERELEASE_SDK': 'false'
  +          },
  +          error: 'Package foo requires SDK version <2.0.0 but the '
  +              'current SDK is 2.0.0.');
  +    });
  +
  +    group("don't apply if", () {
  +      test("major SDK versions differ", () async {
           await d.dir(appPath, [
             await d.pubspec({
               'name': 'myapp',
  
positive.code:             output: isNot(contains('PUB_ALLOW_PRERELEASE_SDK')));
        });
  
        test("exclusive max", () async {
          await d.dir(appPath, [
            await d.pubspec({
              'name': 'myapp',
  
negative.code:             output: isNot(contains('PUB_ALLOW_PRERELEASE_SDK')));
        });
  
        test("lower bound is pre-release and matches SDK", () async {
          await d.dir(appPath, [
            await d.pubspec({
              'name': 'myapp',
  