aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/coro/detached/detached_test.cpp
blob: e8f19f467bb456f8b349d6d622b9e969783de0eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Copyright Vespa.ai. 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()