westonpace commented on a change in pull request #10061:
URL: https://github.com/apache/arrow/pull/10061#discussion_r616023345
##########
File path: cpp/src/arrow/util/async_generator_test.cc
##########
@@ -1102,6 +1105,46 @@ TEST(TestAsyncUtil, ReadaheadFailed) {
ASSERT_TRUE(IsIterationEnd(definitely_last));
}
+class GeneratorIteratorTestFixture : public GeneratorTestFixture {};
+
+TEST_P(GeneratorIteratorTestFixture, Basic) {
+ ASSERT_OK_AND_ASSIGN(
+ auto it, MakeGeneratorIterator(
+ [this](internal::Executor* executor) ->
AsyncGenerator<TestInt> {
+ return MakeSource({1, 2, 3}, executor);
+ }));
+
+ ASSERT_OK_AND_ASSIGN(auto actual, it.ToVector());
+ ASSERT_EQ(std::vector<TestInt>({1, 2, 3}), actual);
+}
+
+TEST_P(GeneratorIteratorTestFixture, Error) {
+ ASSERT_OK_AND_ASSIGN(
+ auto it, MakeGeneratorIterator(
+ [this](internal::Executor* executor) ->
AsyncGenerator<TestInt> {
+ return FailsAt(MakeSource({1, 2, 3}, executor), 1);
+ }));
+
+ ASSERT_RAISES(Invalid, it.ToVector());
+}
+
+TEST_P(GeneratorIteratorTestFixture, Transferred) {
+ ASSERT_OK_AND_ASSIGN(auto mock_io_executor, internal::ThreadPool::Make(1));
+ ASSERT_OK_AND_ASSIGN(
+ auto it,
+ MakeGeneratorIterator([this, &mock_io_executor](internal::Executor*
executor) {
+ auto source = MakeSource({1, 2, 3}, executor);
+ auto to_io = MakeTransferredGenerator(std::move(source),
mock_io_executor.get());
+ auto back = MakeTransferredGenerator(std::move(to_io), executor);
+ return back;
+ }));
+ ASSERT_OK_AND_ASSIGN(auto actual, it.ToVector());
Review comment:
N/A, code removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]