aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/coro/detached/detached_test.cpp
blob: f23d16cc75c2f3c655cfb35345b5e4aac63dc2c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include <vespa/vespalib/coro/detached.h>
#include <vespa/vespalib/gtest/gtest.h>

using vespalib::coro::Detached;

Detached set_result(int &res, int value) {
    res = value;
    co_return;
}

TEST(DetachedTest, call_detached_coroutine) {
    int result = 0;
    set_result(result, 42);
    EXPECT_EQ(result, 42);
}

GTEST_MAIN_RUN_ALL_TESTS()