@@ -90,6 +90,8 @@ static std::string toString(const simplecpp::OutputList &outputList)
9090 case simplecpp::Output::Type::PORTABILITY_BACKSLASH:
9191 ostr << " portability_backslash," ;
9292 break ;
93+ case simplecpp::Output::Type::UNHANDLED_CHAR_ERROR:
94+ ostr << " unhandled_char_error," ;
9395 }
9496
9597 ostr << output.msg << ' \n ' ;
@@ -1086,6 +1088,17 @@ static void readfile_cpp14_number()
10861088 ASSERT_EQUALS (" A = 12345 ;" , readfile (" A = 12\' 345;" ));
10871089}
10881090
1091+ static void readfile_unhandled_chars ()
1092+ {
1093+ simplecpp::OutputList outputList;
1094+ readfile (" // 你好世界" , -1 , &outputList);
1095+ ASSERT_EQUALS (" " , toString (outputList));
1096+ readfile (" s=\" 你好世界\" " , -1 , &outputList);
1097+ ASSERT_EQUALS (" " , toString (outputList));
1098+ readfile (" int 你好世界=0;" , -1 , &outputList);
1099+ ASSERT_EQUALS (" file0,1,unhandled_char_error,The code contains unhandled character(s) (character code=228). Neither unicode nor extended ascii is supported.\n " , toString (outputList));
1100+ }
1101+
10891102static void stringify1 ()
10901103{
10911104 const char code_c[] = " #include \" A.h\"\n "
@@ -1443,6 +1456,7 @@ int main(int argc, char **argv)
14431456 TEST_CASE (readfile_string);
14441457 TEST_CASE (readfile_rawstring);
14451458 TEST_CASE (readfile_cpp14_number);
1459+ TEST_CASE (readfile_unhandled_chars);
14461460
14471461 TEST_CASE (stringify1);
14481462
0 commit comments