Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(382)

Side by Side Diff: packages/csslib/test/compiler_test.dart

Issue 3014633002: Roll to pickup pool changes (Closed)
Patch Set: Created 3 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packages/csslib/pubspec.yaml ('k') | packages/csslib/test/error_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 compiler_test; 5 library compiler_test;
6 6
7 import 'dart:convert'; 7 import 'dart:convert';
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 import 'package:csslib/parser.dart'; 9 import 'package:csslib/parser.dart';
10 import 'package:csslib/src/messages.dart'; 10 import 'package:csslib/src/messages.dart';
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 '}' 526 '}'
527 '#div {' 527 '#div {'
528 'color : #00F578; border-color: #878787;' 528 'color : #00F578; border-color: #878787;'
529 '}]]>'; 529 '}]]>';
530 530
531 var stylesheet = parse(UTF8.encode(input), errors: errors); 531 var stylesheet = parse(UTF8.encode(input), errors: errors);
532 532
533 expect(stylesheet != null, true); 533 expect(stylesheet != null, true);
534 expect(errors.isEmpty, true, reason: errors.toString()); 534 expect(errors.isEmpty, true, reason: errors.toString());
535 535
536 expect( 536 expect(prettyPrint(stylesheet), r'''
537 prettyPrint(stylesheet),
538 r'''
539 .foo { 537 .foo {
540 color: #f00; 538 color: #f00;
541 left: 20px; 539 left: 20px;
542 top: 20px; 540 top: 20px;
543 width: 100px; 541 width: 100px;
544 height: 200px; 542 height: 200px;
545 } 543 }
546 #div { 544 #div {
547 color: #00F578; 545 color: #00F578;
548 border-color: #878787; 546 border-color: #878787;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 588
591 p:nth-child(3n-3) { } 589 p:nth-child(3n-3) { }
592 590
593 div:nth-child(2n) { color : red; } 591 div:nth-child(2n) { color : red; }
594 '''; 592 ''';
595 593
596 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); 594 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
597 595
598 expect(stylesheet != null, true); 596 expect(stylesheet != null, true);
599 expect(errors.isEmpty, true, reason: errors.toString()); 597 expect(errors.isEmpty, true, reason: errors.toString());
600 expect( 598 expect(prettyPrint(stylesheet), r'''
601 prettyPrint(stylesheet),
602 r'''
603 html:lang(fr-ca) { 599 html:lang(fr-ca) {
604 quotes: '" ' ' "'; 600 quotes: '" ' ' "';
605 } 601 }
606 zoom { 602 zoom {
607 } 603 }
608 a:link { 604 a:link {
609 color: #f00; 605 color: #f00;
610 } 606 }
611 :link { 607 :link {
612 color: #00f; 608 color: #00f;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 'overflow-x: marquee;' 658 'overflow-x: marquee;'
663 '}' 659 '}'
664 '* { color: red; }' 660 '* { color: red; }'
665 '*:hover { font-weight: bold; }' 661 '*:hover { font-weight: bold; }'
666 ':nth-child(odd) { color: blue; }' 662 ':nth-child(odd) { color: blue; }'
667 '}'; 663 '}';
668 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); 664 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
669 665
670 expect(stylesheet != null, true); 666 expect(stylesheet != null, true);
671 expect(errors.isEmpty, true, reason: errors.toString()); 667 expect(errors.isEmpty, true, reason: errors.toString());
672 expect( 668 expect(prettyPrint(stylesheet), r'''
673 prettyPrint(stylesheet),
674 r'''
675 @host { 669 @host {
676 :scope { 670 :scope {
677 white-space: nowrap; 671 white-space: nowrap;
678 overflow-style: marquee-line; 672 overflow-style: marquee-line;
679 overflow-x: marquee; 673 overflow-x: marquee;
680 } 674 }
681 * { 675 * {
682 color: #f00; 676 color: #f00;
683 } 677 }
684 *:hover { 678 *:hover {
685 font-weight: bold; 679 font-weight: bold;
686 } 680 }
687 :nth-child(odd) { 681 :nth-child(odd) {
688 color: #00f; 682 color: #00f;
689 } 683 }
690 }'''); 684 }''');
691 } 685 }
692 686
693 void testStringEscape() { 687 void testStringEscape() {
694 var errors = <Message>[]; 688 var errors = <Message>[];
695 var input = r'''a { foo: '{"text" : "a\\\""}' }'''; 689 var input = r'''a { foo: '{"text" : "a\\\""}' }''';
696 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions); 690 var stylesheet = parseCss(input, errors: errors, opts: simpleOptions);
697 expect(stylesheet != null, true); 691 expect(stylesheet != null, true);
698 expect(errors.isEmpty, true, reason: errors.toString()); 692 expect(errors.isEmpty, true, reason: errors.toString());
699 693
700 expect( 694 expect(prettyPrint(stylesheet), r'''
701 prettyPrint(stylesheet),
702 r'''
703 a { 695 a {
704 foo: '{"text" : "a\\\""}'; 696 foo: '{"text" : "a\\\""}';
705 }'''); 697 }''');
706 } 698 }
707 699
708 // TODO(terry): Move to emitter_test.dart when real emitter exist. 700 // TODO(terry): Move to emitter_test.dart when real emitter exist.
709 void testEmitter() { 701 void testEmitter() {
710 var errors = <Message>[]; 702 var errors = <Message>[];
711 var input = '.foo { ' 703 var input = '.foo { '
712 'color: red; left: 20px; top: 20px; width: 100px; height:200px' 704 'color: red; left: 20px; top: 20px; width: 100px; height:200px'
713 '}' 705 '}'
714 '#div {' 706 '#div {'
715 'color : #00F578; border-color: #878787;' 707 'color : #00F578; border-color: #878787;'
716 '}'; 708 '}';
717 var stylesheet = parseCss(input, errors: errors); 709 var stylesheet = parseCss(input, errors: errors);
718 710
719 expect(stylesheet != null, true); 711 expect(stylesheet != null, true);
720 expect(errors.isEmpty, true, reason: errors.toString()); 712 expect(errors.isEmpty, true, reason: errors.toString());
721 713
722 walkTree(stylesheet); 714 walkTree(stylesheet);
723 715
724 expect( 716 expect(prettyPrint(stylesheet), r'''
725 prettyPrint(stylesheet),
726 r'''
727 .foo { 717 .foo {
728 color: #f00; 718 color: #f00;
729 left: 20px; 719 left: 20px;
730 top: 20px; 720 top: 20px;
731 width: 100px; 721 width: 100px;
732 height: 200px; 722 height: 200px;
733 } 723 }
734 #div { 724 #div {
735 color: #00F578; 725 color: #00F578;
736 border-color: #878787; 726 border-color: #878787;
(...skipping 11 matching lines...) Expand all
748 test('Combinator', testCombinator); 738 test('Combinator', testCombinator);
749 test('Wildcards', testWildcard); 739 test('Wildcards', testWildcard);
750 test('Pseudo', testPseudo); 740 test('Pseudo', testPseudo);
751 test('Attributes', testAttribute); 741 test('Attributes', testAttribute);
752 test('Negation', testNegation); 742 test('Negation', testNegation);
753 test('@host', testHost); 743 test('@host', testHost);
754 test('stringEscape', testStringEscape); 744 test('stringEscape', testStringEscape);
755 test('Parse List<int> as input', testArrayOfChars); 745 test('Parse List<int> as input', testArrayOfChars);
756 test('Simple Emitter', testEmitter); 746 test('Simple Emitter', testEmitter);
757 } 747 }
OLDNEW
« no previous file with comments | « packages/csslib/pubspec.yaml ('k') | packages/csslib/test/error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698