2019-11-18 06:50:31 +08:00
|
|
|
/* Self tests for the TUI
|
|
|
|
|
2024-01-12 23:30:44 +08:00
|
|
|
Copyright (C) 2019-2024 Free Software Foundation, Inc.
|
2019-11-18 06:50:31 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
#include "gdbsupport/selftest.h"
|
|
|
|
|
2019-12-03 07:12:19 +08:00
|
|
|
#ifdef TUI
|
|
|
|
|
2019-12-04 23:08:13 +08:00
|
|
|
#include "tui/tui-winsource.h"
|
|
|
|
|
2019-11-18 06:50:31 +08:00
|
|
|
namespace selftests {
|
|
|
|
namespace tui {
|
|
|
|
|
|
|
|
static void
|
|
|
|
run_tests ()
|
|
|
|
{
|
|
|
|
const char *text = "hello";
|
2020-09-28 10:30:30 +08:00
|
|
|
std::string result = tui_copy_source_line (&text);
|
2019-11-18 06:50:31 +08:00
|
|
|
SELF_CHECK (result == "hello");
|
|
|
|
SELF_CHECK (*text == '\0');
|
|
|
|
|
|
|
|
text = "hello\n";
|
2020-09-28 10:30:30 +08:00
|
|
|
result = tui_copy_source_line (&text);
|
|
|
|
SELF_CHECK (result == "hello");
|
2019-11-18 06:50:31 +08:00
|
|
|
SELF_CHECK (*text == '\0');
|
|
|
|
}
|
|
|
|
|
|
|
|
} /* namespace tui*/
|
|
|
|
} /* namespace selftests */
|
|
|
|
|
2019-12-03 07:12:19 +08:00
|
|
|
#endif /* TUI */
|
|
|
|
|
2020-01-14 03:01:38 +08:00
|
|
|
void _initialize_tui_selftest ();
|
2019-11-18 06:50:31 +08:00
|
|
|
void
|
|
|
|
_initialize_tui_selftest ()
|
|
|
|
{
|
2019-12-03 07:12:19 +08:00
|
|
|
#ifdef TUI
|
2019-11-18 06:50:31 +08:00
|
|
|
selftests::register_test ("tui", selftests::tui::run_tests);
|
2019-12-03 07:12:19 +08:00
|
|
|
#endif
|
2019-11-18 06:50:31 +08:00
|
|
|
}
|