Skip to content

Commit bcb2c19

Browse files
Update test
1 parent 7bb0d7f commit bcb2c19

1 file changed

Lines changed: 27 additions & 12 deletions

File tree

script/tool/test/license_check_command_test.dart

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -463,22 +463,35 @@ void main() {
463463
);
464464

465465
test('succeeds for third-party code in a third_party directory', () async {
466-
final File thirdPartyFile = root
467-
.childDirectory('a_plugin')
468-
.childDirectory('lib')
469-
.childDirectory('src')
466+
final File thirdPartyLicenseFile = root
470467
.childDirectory('third_party')
471-
.childFile('file.cc');
472-
thirdPartyFile.createSync(recursive: true);
468+
.childDirectory('packages')
469+
.childDirectory('path_parsing')
470+
.childFile('LICENSE');
471+
thirdPartyLicenseFile.createSync(recursive: true);
473472
writeLicense(
474-
thirdPartyFile,
475-
copyright: 'Copyright (c) 2013, Greg Lowe',
473+
thirdPartyLicenseFile,
474+
comment: '',
475+
copyright: 'Copyright (c) 2018 Dan Field\n',
476476
license: <String>[
477-
'Redistribution and use in source and binary forms, with or without '
478-
'modification, are permitted provided that the following '
479-
'conditions are met:',
477+
'Permission is hereby granted, free of charge, to any person obtaining a copy\n'
478+
'of this software and associated documentation files (the "Software"), to deal\n'
479+
'in the Software without restriction, including without limitation the rights\n'
480+
'to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n'
481+
'copies of the Software, and to permit persons to whom the Software is\n'
482+
'furnished to do so, subject to the following conditions:',
480483
],
481484
);
485+
// Create an empty code file; this package should redirect to the LICENSE
486+
// file instead.
487+
final File thirdPartyCodeFile = root
488+
.childDirectory('third_party')
489+
.childDirectory('packages')
490+
.childDirectory('path_parsing')
491+
.childDirectory('lib')
492+
.childFile('path_parsing.dart');
493+
thirdPartyCodeFile.createSync(recursive: true);
494+
thirdPartyCodeFile.writeAsStringSync('main() {}');
482495
mockGitFilesListWithAllFiles(root);
483496

484497
final List<String> output = await runCapturingPrint(runner, <String>[
@@ -489,7 +502,9 @@ void main() {
489502
expect(
490503
output,
491504
containsAllInOrder(<Matcher>[
492-
contains('Checking a_plugin/lib/src/third_party/file.cc'),
505+
contains(
506+
'Checking third_party/packages/path_parsing/lib/path_parsing.dart',
507+
),
493508
contains('All files passed validation!'),
494509
]),
495510
);

0 commit comments

Comments
 (0)