Skip to content

Commit 3a545d7

Browse files
committed
[Change] Sync test/archlinux/aur_poc/ with test/
1 parent 68dd3ce commit 3a545d7

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

test/archlinux/aur_poc/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,12 @@ else()
168168
target_link_libraries(test_unicodecvt PRIVATE bux Catch2::Catch2WithMain stdc++ m)
169169
endif()
170170
add_test(NAME test_unicodecvt_All COMMAND test_unicodecvt)
171+
172+
add_executable(test_lexbase test_lexbase.cpp)
173+
target_include_directories(test_lexbase PRIVATE ../include)
174+
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
175+
target_link_libraries(test_lexbase PRIVATE bux Catch2::Catch2WithMain)
176+
else()
177+
target_link_libraries(test_lexbase PRIVATE bux Catch2::Catch2WithMain stdc++ m)
178+
endif()
179+
add_test(NAME test_lexbase_All COMMAND test_lexbase)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
Test cases are organized according to ZOMBIES rules
3+
http://blog.wingman-sw.com/tdd-guided-by-zombies
4+
*/
5+
#include <bux/LexBase.h> // bux::asciiLiteral()
6+
//#include <bux/UnicodeCvt.h> // bux::BOM()
7+
#include <catch2/catch_test_macros.hpp>
8+
9+
TEST_CASE("Regression errors", "[S]")
10+
{
11+
CHECK(bux::asciiLiteral("::") == "::");
12+
CHECK(bux::asciiLiteral("::=") == "::=");
13+
}
14+
15+
TEST_CASE("Expectations", "[S]")
16+
{
17+
CHECK(bux::asciiLiteral("\n") == "\\n");
18+
CHECK(bux::asciiLiteral("\r") == "\\r");
19+
CHECK(bux::asciiLiteral("\t") == "\\t");
20+
//
21+
CHECK(bux::asciiLiteral((const char*)u8"\u1234") == (const char*)u8"\u1234");
22+
CHECK(bux::asciiLiteral((const char*)u8"\uABCD") == (const char*)u8"\uABCD");
23+
}

test/archlinux/aur_poc/test_unicodecvt.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Test cases are organized according to ZOMBIES rules
33
http://blog.wingman-sw.com/tdd-guided-by-zombies
44
*/
5-
//#include <bux/LexBase.h> // bux::asciiLiteral()
65
#include <bux/UnicodeCvt.h> // bux::to_utf8(), bux::BOM()
76
#include <catch2/catch_test_macros.hpp>
87

@@ -40,8 +39,10 @@ TEST_CASE("String to utf-8 vs stringview to utf-8", "[S]")
4039
CHECK(bux::to_utf8(u16str) == (const char*)u8"一律轉成 utf-8");
4140
for (auto &ch: u16str)
4241
ch = std::byteswap(ch);
42+
#ifdef __unix__
4343
static constinit const char *const CHSETS_UTF16BE[] = {"UTF-16BE", "UTF16BE", "UCS-2BE", "USC2BE", 0};
4444
CHECK(bux::to_utf8(u16str, 0, CHSETS_UTF16BE) == (const char*)u8"一律轉成 utf-8");
45+
#endif
4546
CHECK(bux::to_utf8(u16str) == (const char*)u8"一律轉成 utf-8");
4647

4748
CHECK(bux::to_utf8(u8"一律轉成 utf-8", 0, bux::ENCODING_UTF8) == (const char*)u8"一律轉成 utf-8");

0 commit comments

Comments
 (0)