blob: 33231c1246e654702356a511767d64ac06aa27a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "qtcassert.h"
#include "../3rdparty/tl_expected/include/tl/expected.hpp"
namespace Utils {
using namespace tl;
template<class T>
using expected_str = tl::expected<T, QString>;
} // namespace Utils
//! If 'expected' has an error the error will be printed and the 'action' will be executed.
#define QTC_ASSERT_EXPECTED(expected, action) \
if (Q_LIKELY(expected)) { \
} else { \
::Utils::writeAssertLocation(QString("%1:%2: %3") \
.arg(__FILE__) \
.arg(__LINE__) \
.arg(expected.error()) \
.toUtf8() \
.data()); \
action; \
} \
do { \
} while (0)
|