This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Add a minimal example of using package:test.
#51726
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a4d0662
Add a minimal example of using package:test.
matanlurey 38e9f6e
Fix lint.
matanlurey 28c9664
++
matanlurey f96cfc1
Merge remote-tracking branch 'upstream/main' into engine-pkg-test
matanlurey 82df078
Add DEPS, demo should now work.
matanlurey d9cbd30
++
matanlurey 7fc9fd7
++
matanlurey 6e9a44f
++
matanlurey 4acb218
++
matanlurey fa8ba58
++
matanlurey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Demo of `package:test` with `DEPS`-vendored packages | ||
|
|
||
| Historically, `flutter/engine` used a homegrown test framework, | ||
| [`package:litetest`](../litetest/) to avoid depending on the unwieldy set of | ||
| dependencies that `package:test` brings in. However, `package:test` is now | ||
| vendored in `DEPS` (used by the Dart SDK).' | ||
|
|
||
| This demo shows that: | ||
|
|
||
| - It's possible to use `package:test` with entirely local dependencies. | ||
| - The functionality of `package:test` (such as filtering, IDE integration, etc.) | ||
| is available. | ||
|
|
||
| See <https://github.com/flutter/flutter/issues/133569> for details. | ||
|
|
||
| ## Usage | ||
|
|
||
| Navigate to this directory: | ||
|
|
||
| ```sh | ||
| cd testing/pkg_test_demo | ||
| ``` | ||
|
|
||
| And run the tests using `dart test`[^1]: | ||
|
|
||
| ```sh | ||
| dart test | ||
| ``` | ||
|
|
||
| [^1]: | ||
| In practice, you'll want to use the `dart` binary that is vendored in the | ||
| pre-built SDK. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Copyright 2013 The Flutter Authors. All rights reserved. | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file. | ||
|
|
||
| name: pkg_test_demo | ||
| publish_to: none | ||
|
|
||
| # Do not add any dependencies that require more than what is provided in | ||
| # //third_party/dart/pkg or //third_party/dart/third_party/pkg. | ||
|
|
||
| # If you do add packages here, make sure you can run `pub get --offline`, and | ||
| # check the .packages and .package_config to make sure all the paths are | ||
| # relative to this directory into //third_party/dart | ||
|
|
||
| environment: | ||
| sdk: '>=3.2.0-0 <4.0.0' | ||
|
|
||
| dev_dependencies: | ||
| test: | ||
|
|
||
| dependency_overrides: | ||
| _fe_analyzer_shared: | ||
| path: ../../../third_party/dart/pkg/_fe_analyzer_shared | ||
| _macros: | ||
| path: ../../../third_party/dart/pkg/_macros | ||
| analyzer: | ||
| path: ../../../third_party/dart/pkg/analyzer | ||
| args: | ||
| path: ../../../third_party/dart/third_party/pkg/args | ||
| async: | ||
| path: ../../../third_party/dart/third_party/pkg/async | ||
| boolean_selector: | ||
| path: ../../../third_party/dart/third_party/pkg/boolean_selector | ||
| collection: | ||
| path: ../../../third_party/dart/third_party/pkg/collection | ||
| convert: | ||
| path: ../../../third_party/dart/third_party/pkg/convert | ||
| coverage: | ||
| path: ../../third_party/pkg/coverage | ||
| crypto: | ||
| path: ../../../third_party/dart/third_party/pkg/crypto | ||
| file: | ||
| path: ../../../third_party/dart/third_party/pkg/file/packages/file | ||
| frontend_server_client: | ||
| path: ../../../third_party/dart/third_party/pkg/webdev/frontend_server_client | ||
| glob: | ||
| path: ../../../third_party/dart/third_party/pkg/glob | ||
| http_multi_server: | ||
| path: ../../../third_party/dart/third_party/pkg/http_multi_server | ||
| http_parser: | ||
| path: ../../../third_party/dart/third_party/pkg/http_parser | ||
| io: | ||
| path: ../../third_party/pkg/io | ||
| js: | ||
| path: ../../../third_party/dart/pkg/js | ||
| logging: | ||
| path: ../../../third_party/dart/third_party/pkg/logging | ||
| macros: | ||
| path: ../../../third_party/dart/pkg/macros | ||
| matcher: | ||
| path: ../../../third_party/dart/third_party/pkg/matcher | ||
| meta: | ||
| path: ../../../third_party/dart/pkg/meta | ||
| mime: | ||
| path: ../../../third_party/dart/third_party/pkg/mime | ||
| node_preamble: | ||
| path: ../../third_party/pkg/node_preamble | ||
| package_config: | ||
| path: ../../../third_party/dart/third_party/pkg/package_config | ||
| path: | ||
| path: ../../../third_party/dart/third_party/pkg/path | ||
| pool: | ||
| path: ../../../third_party/dart/third_party/pkg/pool | ||
| pub_semver: | ||
| path: ../../../third_party/dart/third_party/pkg/pub_semver | ||
| shelf: | ||
| path: ../../../third_party/dart/third_party/pkg/shelf/pkgs/shelf | ||
| shelf_packages_handler: | ||
| path: ../../../third_party/dart/third_party/pkg/shelf/pkgs/shelf_packages_handler | ||
| shelf_static: | ||
| path: ../../../third_party/dart/third_party/pkg/shelf/pkgs/shelf_static | ||
| shelf_web_socket: | ||
| path: ../../../third_party/dart/third_party/pkg/shelf/pkgs/shelf_web_socket | ||
| source_map_stack_trace: | ||
| path: ../../../third_party/dart/third_party/pkg/source_map_stack_trace | ||
| source_maps: | ||
| path: ../../../third_party/dart/third_party/pkg/source_maps | ||
| source_span: | ||
| path: ../../../third_party/dart/third_party/pkg/source_span | ||
| stack_trace: | ||
| path: ../../../third_party/dart/third_party/pkg/stack_trace | ||
| stream_channel: | ||
| path: ../../../third_party/dart/third_party/pkg/stream_channel | ||
| string_scanner: | ||
| path: ../../../third_party/dart/third_party/pkg/string_scanner | ||
| term_glyph: | ||
| path: ../../../third_party/dart/third_party/pkg/term_glyph | ||
| test: | ||
| path: ../../../third_party/dart/third_party/pkg/test/pkgs/test | ||
| test_api: | ||
| path: ../../../third_party/dart/third_party/pkg/test/pkgs/test_api | ||
| test_core: | ||
| path: ../../../third_party/dart/third_party/pkg/test/pkgs/test_core | ||
| typed_data: | ||
| path: ../../../third_party/dart/third_party/pkg/typed_data | ||
| vm_service: | ||
| path: ../../../third_party/dart/pkg/vm_service | ||
| watcher: | ||
| path: ../../../third_party/dart/third_party/pkg/watcher | ||
| web: | ||
| path: ../../../third_party/dart/third_party/pkg/web | ||
| web_socket_channel: | ||
| path: ../../../third_party/dart/third_party/pkg/web_socket_channel | ||
| webkit_inspection_protocol: | ||
| path: ../../../third_party/dart/third_party/pkg/webkit_inspection_protocol | ||
| yaml: | ||
| path: ../../../third_party/dart/third_party/pkg/yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:test/test.dart'; | ||
|
|
||
| void main() { | ||
| test('String.split() splits the string on the delimiter', () { | ||
| const String string = 'foo,bar,baz'; | ||
| expect(string.split(','), equals(<String>['foo', 'bar', 'baz'])); | ||
| }); | ||
|
|
||
| test('String.trim() removes surrounding whitespace', () { | ||
| const String string = ' foo '; | ||
| expect(string.trim(), equals('foo')); | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Needs the engine copyright header.
(Hopefully when we finish the buildmoot, this can be enforced by a tool.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.