@@ -13,7 +13,6 @@ import 'dart:io';
13
13
import 'package:dartdoc/dartdoc.dart' ;
14
14
import 'package:dartdoc/src/model/model.dart' ;
15
15
import 'package:dartdoc/src/special_elements.dart' ;
16
- import 'package:dartdoc/src/warnings.dart' ;
17
16
import 'package:pub_semver/pub_semver.dart' ;
18
17
import 'package:test/test.dart' ;
19
18
@@ -486,199 +485,4 @@ void main() {
486
485
'${HTMLBASE_PLACEHOLDER }dart-async/dart-async-library.html' );
487
486
});
488
487
});
489
-
490
- group ('YouTube Errors' , () {
491
- PackageGraph packageGraphErrors;
492
- Class documentationErrors;
493
- Method withYouTubeWrongParams;
494
- Method withYouTubeBadWidth;
495
- Method withYouTubeBadHeight;
496
- Method withYouTubeInvalidUrl;
497
- Method withYouTubeUrlWithAdditionalParameters;
498
-
499
- setUpAll (() async {
500
- packageGraphErrors = await utils.testPackageGraphErrors;
501
- documentationErrors = packageGraphErrors.libraries
502
- .firstWhere ((lib) => lib.name == 'doc_errors' )
503
- .classes
504
- .firstWhere ((c) => c.name == 'DocumentationErrors' )
505
- ..documentation;
506
- withYouTubeWrongParams = documentationErrors.instanceMethods
507
- .firstWhere ((m) => m.name == 'withYouTubeWrongParams' )
508
- ..documentation;
509
- withYouTubeBadWidth = documentationErrors.instanceMethods
510
- .firstWhere ((m) => m.name == 'withYouTubeBadWidth' )
511
- ..documentation;
512
- withYouTubeBadHeight = documentationErrors.instanceMethods
513
- .firstWhere ((m) => m.name == 'withYouTubeBadHeight' )
514
- ..documentation;
515
- withYouTubeInvalidUrl = documentationErrors.instanceMethods
516
- .firstWhere ((m) => m.name == 'withYouTubeInvalidUrl' )
517
- ..documentation;
518
- withYouTubeUrlWithAdditionalParameters = documentationErrors
519
- .instanceMethods
520
- .firstWhere ((m) => m.name == 'withYouTubeUrlWithAdditionalParameters' )
521
- ..documentation;
522
- });
523
-
524
- test ('warns on youtube video with missing parameters' , () {
525
- expect (
526
- packageGraphErrors.packageWarningCounter.hasWarning (
527
- withYouTubeWrongParams,
528
- PackageWarning .invalidParameter,
529
- 'Invalid @youtube directive, "{@youtube https://youtu.be/oHg5SJYRHA0}"\n '
530
- 'YouTube directives must be of the form "{@youtube WIDTH HEIGHT URL}"' ),
531
- isTrue);
532
- });
533
- test ('warns on youtube video with non-integer width' , () {
534
- expect (
535
- packageGraphErrors.packageWarningCounter.hasWarning (
536
- withYouTubeBadWidth,
537
- PackageWarning .invalidParameter,
538
- 'A @youtube directive has an invalid width, "100px". The width '
539
- 'must be a positive integer.' ),
540
- isTrue);
541
- });
542
- test ('warns on youtube video with non-integer height' , () {
543
- expect (
544
- packageGraphErrors.packageWarningCounter.hasWarning (
545
- withYouTubeBadHeight,
546
- PackageWarning .invalidParameter,
547
- 'A @youtube directive has an invalid height, "100px". The height '
548
- 'must be a positive integer.' ),
549
- isTrue);
550
- });
551
- test ('warns on youtube video with invalid video URL' , () {
552
- expect (
553
- packageGraphErrors.packageWarningCounter.hasWarning (
554
- withYouTubeInvalidUrl,
555
- PackageWarning .invalidParameter,
556
- 'A @youtube directive has an invalid URL: '
557
- '"http://host/path/to/video.mp4". Supported YouTube URLs have '
558
- 'the following format: '
559
- 'https://www.youtube.com/watch?v=oHg5SJYRHA0.' ),
560
- isTrue);
561
- });
562
- test ('warns on youtube video with extra parameters in URL' , () {
563
- expect (
564
- packageGraphErrors.packageWarningCounter.hasWarning (
565
- withYouTubeUrlWithAdditionalParameters,
566
- PackageWarning .invalidParameter,
567
- 'A @youtube directive has an invalid URL: '
568
- '"https://www.youtube.com/watch?v=yI-8QHpGIP4&list=PLjxrf2q8roU23XGwz3Km7sQZFTdB996iG&index=5". '
569
- 'Supported YouTube URLs have the following format: '
570
- 'https://www.youtube.com/watch?v=oHg5SJYRHA0.' ),
571
- isTrue);
572
- });
573
- });
574
-
575
- group ('Animation Errors' , () {
576
- PackageGraph packageGraphErrors;
577
- Class documentationErrors;
578
- Method withInvalidNamedAnimation;
579
- Method withAnimationNonUnique;
580
- Method withAnimationNonUniqueDeprecated;
581
- Method withAnimationWrongParams;
582
- Method withAnimationBadWidth;
583
- Method withAnimationBadHeight;
584
- Method withAnimationUnknownArg;
585
-
586
- setUpAll (() async {
587
- packageGraphErrors = await utils.testPackageGraphErrors;
588
- documentationErrors = packageGraphErrors.libraries
589
- .firstWhere ((lib) => lib.name == 'doc_errors' )
590
- .classes
591
- .firstWhere ((c) => c.name == 'DocumentationErrors' )
592
- ..documentation;
593
- withInvalidNamedAnimation = documentationErrors.instanceMethods
594
- .firstWhere ((m) => m.name == 'withInvalidNamedAnimation' )
595
- ..documentation;
596
- withAnimationNonUnique = documentationErrors.instanceMethods
597
- .firstWhere ((m) => m.name == 'withAnimationNonUnique' )
598
- ..documentation;
599
- withAnimationNonUniqueDeprecated = documentationErrors.instanceMethods
600
- .firstWhere ((m) => m.name == 'withAnimationNonUniqueDeprecated' )
601
- ..documentation;
602
- withAnimationWrongParams = documentationErrors.instanceMethods
603
- .firstWhere ((m) => m.name == 'withAnimationWrongParams' )
604
- ..documentation;
605
- withAnimationBadWidth = documentationErrors.instanceMethods
606
- .firstWhere ((m) => m.name == 'withAnimationBadWidth' )
607
- ..documentation;
608
- withAnimationBadHeight = documentationErrors.instanceMethods
609
- .firstWhere ((m) => m.name == 'withAnimationBadHeight' )
610
- ..documentation;
611
- withAnimationUnknownArg = documentationErrors.instanceMethods
612
- .firstWhere ((m) => m.name == 'withAnimationUnknownArg' )
613
- ..documentation;
614
- });
615
-
616
- test ('warns with invalidly-named animation within the method documentation' ,
617
- () async {
618
- expect (
619
- packageGraphErrors.packageWarningCounter.hasWarning (
620
- withInvalidNamedAnimation,
621
- PackageWarning .invalidParameter,
622
- 'An animation has an invalid identifier, "2isNot-A-ValidName". '
623
- 'The identifier can only contain letters, numbers and '
624
- 'underscores, and must not begin with a number.' ),
625
- isTrue);
626
- });
627
- test ('warns on a non-unique animation name within a method' , () {
628
- expect (
629
- packageGraphErrors.packageWarningCounter.hasWarning (
630
- withAnimationNonUnique,
631
- PackageWarning .invalidParameter,
632
- 'An animation has a non-unique identifier, "barHerderAnimation". '
633
- 'Animation identifiers must be unique.' ),
634
- isTrue);
635
- });
636
- test ('warns on a non-unique animation name within a deprecated-form method' ,
637
- () {
638
- expect (
639
- packageGraphErrors.packageWarningCounter.hasWarning (
640
- withAnimationNonUniqueDeprecated,
641
- PackageWarning .invalidParameter,
642
- 'An animation has a non-unique identifier, "fooHerderAnimation". '
643
- 'Animation identifiers must be unique.' ),
644
- isTrue);
645
- });
646
- test ('warns on animation with missing parameters' , () {
647
- expect (
648
- packageGraphErrors.packageWarningCounter.hasWarning (
649
- withAnimationWrongParams,
650
- PackageWarning .invalidParameter,
651
- 'Invalid @animation directive, "{@animation http://host/path/to/video.mp4}"\n '
652
- 'Animation directives must be of the form "{@animation WIDTH '
653
- 'HEIGHT URL [id=ID]}"' ),
654
- isTrue);
655
- });
656
- test ('warns on animation with non-integer width' , () {
657
- expect (
658
- packageGraphErrors.packageWarningCounter.hasWarning (
659
- withAnimationBadWidth,
660
- PackageWarning .invalidParameter,
661
- 'An animation has an invalid width (badWidthAnimation), "100px". '
662
- 'The width must be an integer.' ),
663
- isTrue);
664
- });
665
- test ('warns on animation with non-integer height' , () {
666
- expect (
667
- packageGraphErrors.packageWarningCounter.hasWarning (
668
- withAnimationBadHeight,
669
- PackageWarning .invalidParameter,
670
- 'An animation has an invalid height (badHeightAnimation), '
671
- '"100px". The height must be an integer.' ),
672
- isTrue);
673
- });
674
- test ('Unknown arguments generate an error.' , () {
675
- expect (
676
- packageGraphErrors.packageWarningCounter.hasWarning (
677
- withAnimationUnknownArg,
678
- PackageWarning .invalidParameter,
679
- 'The {@animation ...} directive was called with invalid '
680
- 'parameters. FormatException: Could not find an option named "name".' ),
681
- isTrue);
682
- });
683
- }, timeout: Timeout .factor (2 ));
684
488
}
0 commit comments