mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-03 14:26:09 +00:00
add some tests for LuaAPI FS, termios
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include "Compat.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#ifndef WIN32
|
||||
|
||||
static struct termios old, current;
|
||||
@@ -20,6 +23,21 @@ void resetTermios(void) {
|
||||
tcsetattr(0, TCSANOW, &old);
|
||||
}
|
||||
|
||||
TEST_CASE("init and reset termios") {
|
||||
struct termios original;
|
||||
tcgetattr(0, &original);
|
||||
SUBCASE("no echo") {
|
||||
initTermios(false);
|
||||
}
|
||||
SUBCASE("yes echo") {
|
||||
initTermios(true);
|
||||
}
|
||||
resetTermios();
|
||||
struct termios current;
|
||||
tcgetattr(0, ¤t);
|
||||
CHECK(std::memcmp(&original, ¤t, sizeof(struct termios)) == 0);
|
||||
}
|
||||
|
||||
char getch_(int echo) {
|
||||
char ch;
|
||||
initTermios(echo);
|
||||
|
||||
Reference in New Issue
Block a user