Skip to content

Commit

Permalink
Add workaround for FreeBSD+NetBSD CITRUS iconv, skipping test
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyCat committed Jun 5, 2024
1 parent 26a141a commit 44bce3e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <gtest/gtest.h>
#endif

#include <sys/param.h>

#include "kaitai/kaitaistream.h"
#include "kaitai/exceptions.h"
#include <sstream>
Expand Down Expand Up @@ -359,7 +361,6 @@ TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_euc_jp_too_short)
}
}


TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_gb2312_too_short)
{
try {
Expand All @@ -376,8 +377,12 @@ TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_gb2312_too_short)
}
}

#if !defined(__FreeBSD__) && !defined(__NetBSD__)
TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_gb2312_two_bytes)
{
// 0xB0 0x30 is illegal sequence in GB2312: 0xB0 must be followed by [0xA1..0xFE].
// However, some iconv engines, namely CITRUS integrated with modern FreeBSD (10+) and NetBSD,
// are not considering this as error and thus not returning EILSEQ.
try {
std::string res = kaitai::kstream::bytes_to_str("\xb0\x30", "GB2312");
FAIL() << "Expected illegal_seq_in_encoding exception";
Expand All @@ -391,6 +396,7 @@ TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_gb2312_two_bytes)
#endif
}
}
#endif

TEST(KaitaiStreamTest, bytes_to_str_invalid_seq_utf_16le_odd_bytes)
{
Expand Down

0 comments on commit 44bce3e

Please sign in to comment.