Skip to content

Commit 9390e96

Browse files
committed
Moved commit "Always use Utf8 aware TextWalker for antlr4" from ydb repo
1 parent 4d14932 commit 9390e96

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tests/unit/library/yql_common/issue/yql_issue_ut.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(TextWalkerTest) {
9292
TPosition pos;
9393
pos.Row = 1;
9494

95-
TTextWalker walker(pos);
95+
TTextWalker walker(pos, false);
9696
walker.Advance("a\r\taa"sv);
9797

9898
UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(5, 1));
@@ -104,7 +104,7 @@ Y_UNIT_TEST_SUITE(TextWalkerTest) {
104104
TPosition pos;
105105
pos.Row = 1;
106106

107-
TTextWalker walker(pos);
107+
TTextWalker walker(pos, false);
108108
walker.Advance("a\raa\r"sv);
109109
UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(4, 1));
110110
walker.Advance('\n');
@@ -118,6 +118,28 @@ Y_UNIT_TEST_SUITE(TextWalkerTest) {
118118
walker.Advance('a');
119119
UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(1, 3));
120120
}
121+
122+
Y_UNIT_TEST(UnicodeTest) {
123+
{
124+
TPosition pos;
125+
pos.Row = 1;
126+
127+
TTextWalker walker(pos, false);
128+
walker.Advance(TStringBuf("привет"));
129+
130+
UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(12, 1));
131+
}
132+
133+
{
134+
TPosition pos;
135+
pos.Row = 1;
136+
137+
TTextWalker walker(pos, true);
138+
walker.Advance(TStringBuf("привет"));
139+
140+
UNIT_ASSERT_VALUES_EQUAL(pos, TPosition(6, 1));
141+
}
142+
}
121143
}
122144

123145
Y_UNIT_TEST_SUITE(ToOneLineStringTest) {

0 commit comments

Comments
 (0)