enso/test/Google_Api_Test/src/Main.enso
Pavel Marek 21e1284086
Enso tests can be run with filter from cmdline (#9065)
Simplify the `Test.Suite.run_with_filter` to accept a single filter parameter that searches for all the groups and specs that matches that filter. This filter can be a simple text provided from the command line.

# Important Notes
- Pending groups are now printed at the end of the run
- `Test.Suite.run_with_filter` is simplified to accept a single filter parameter that is either `Text` or `Nothing`. See the docs.
- Passing a filter from the command line is therefore straightforward, it is treated as a regex.
- For convenience, I have left all the `main` methods in all the test sources. I have just refactored them to accept the `filter` argument from the command line.
- For example, to run only a single spec from `Vector_Spec.enso`, invoke `enso --run test/Base_Tests/src/Data/Vector_Spec.enso "should allow vector creation with a programmatic constructor"`
- **Majority of the PR is a regex replace** of `^main =` for `main filter=Nothing =` and of `suite.run_with_filter` for `suite.run_with_filter filter`.
- **Fixed some internal engine bugs:**
- `AtomWithHole` allows to specify only one hole - https://github.com/enso-org/enso/pull/9065/files#diff-0f7bb7e85cf86a965de133aa7e6b5958ceb889bd1921c01e00d3a9ceb19626ef
- NaN keys in hash maps are handled in polyglot maps as well - c5257f6c2b78f893214ff67300893b593ea05e21..db4b3c0e9828ee79208d52e02586b24bb845b0d6
2024-02-22 12:31:44 +00:00

27 lines
874 B
Plaintext

from Standard.Base import all
import Standard.Google_Api
from Standard.Test import all
main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder
suite.run_with_filter filter
add_specs suite_builder =
secret = enso_project.data / 'secret.json'
api = Google_Api.initialize secret
suite_builder.group "Google Spreadsheets" group_builder->
group_builder.specify "should allow downloading a spreadsheet" <|
sheet_id = '1WjVQhYdc04RwdWB22RNLgfQiLeWYhxiij1_xj22RDq0'
sheet_range = 'Sheet1!A1:B6'
table = api.spreadsheets.get_table sheet_id sheet_range
table.columns.map .name . should_equal ["Foo", "Bar"]
table.at 'Foo' . to_vector . should_equal [1,2,3,4,5]
table.at 'Bar' . to_vector . should_equal ["hello", "world", "foo", "bar", "baz"]