| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library mixin_test; | 5 library mixin_test; |
| 6 | 6 |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'testing.dart'; | 8 import 'testing.dart'; |
| 9 | 9 |
| 10 final options = ['--warnings_as_errors', '--no-colors', 'memory']; | 10 final options = ['--warnings_as_errors', '--no-colors', 'memory']; |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 @mixin a { | 451 @mixin a { |
| 452 span { | 452 span { |
| 453 border: 2px dashed red; | 453 border: 2px dashed red; |
| 454 } | 454 } |
| 455 @include b; | 455 @include b; |
| 456 } | 456 } |
| 457 | 457 |
| 458 @include a; | 458 @include a; |
| 459 '''; | 459 '''; |
| 460 | 460 |
| 461 var generated = r'''span { | |
| 462 border: 2px dashed #f00; | |
| 463 }'''; | |
| 464 | |
| 465 var stylesheet = compileCss(input, errors: errors, opts: options); | 461 var stylesheet = compileCss(input, errors: errors, opts: options); |
| 466 expect(stylesheet != null, true); | 462 expect(stylesheet != null, true); |
| 467 expect(errors.length, 1, reason: errors.toString()); | 463 expect(errors.length, 1, reason: errors.toString()); |
| 468 var error = errors[0]; | 464 var error = errors[0]; |
| 469 expect(error.message, 'Using declaration mixin b as top-level mixin'); | 465 expect(error.message, 'Using declaration mixin b as top-level mixin'); |
| 470 expect(error.span.start.line, 8); | 466 expect(error.span.start.line, 8); |
| 471 expect(error.span.end.offset, 90); | 467 expect(error.span.end.offset, 90); |
| 472 } | 468 } |
| 473 | 469 |
| 474 void emptyMixin() { | 470 void emptyMixin() { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 test('multiple args and var decls as args', mixinManyArgs); | 651 test('multiple args and var decls as args', mixinManyArgs); |
| 656 }); | 652 }); |
| 657 | 653 |
| 658 group('Mixin warnings', () { | 654 group('Mixin warnings', () { |
| 659 test('undefined top-level', undefinedTopLevel); | 655 test('undefined top-level', undefinedTopLevel); |
| 660 test('undefined declaration', undefinedDeclaration); | 656 test('undefined declaration', undefinedDeclaration); |
| 661 test('detect bad top-level as declaration', badDeclarationInclude); | 657 test('detect bad top-level as declaration', badDeclarationInclude); |
| 662 test('detect bad declaration as top-level', badTopInclude); | 658 test('detect bad declaration as top-level', badTopInclude); |
| 663 }); | 659 }); |
| 664 } | 660 } |
| OLD | NEW |