File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
yql/essentials/public/fastcheck Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ class TFormatRunner : public ICheckRunner {
77
77
auto formatter = NSQLFormat::MakeSqlFormatter (lexers, parsers, settings);
78
78
TString formattedQuery;
79
79
res.Success = formatter->Format (request.Program , formattedQuery, res.Issues );
80
- if (res.Success && formattedQuery != NormalizeEOL (request.Program )) {
80
+ if (res.Success && NormalizeEOL ( formattedQuery) != NormalizeEOL (request.Program )) {
81
81
res.Success = false ;
82
82
TPosition origPos (0 , 1 , request.File );
83
83
TTextWalker origWalker (origPos, true );
Original file line number Diff line number Diff line change @@ -115,6 +115,19 @@ Y_UNIT_TEST_SUITE(TLinterTests) {
115
115
UNIT_ASSERT_VALUES_EQUAL (res.Checks [0 ].Issues .Size (), 0 );
116
116
}
117
117
118
+ Y_UNIT_TEST (GoodFormatYqlWithWinEOLInComment) {
119
+ TChecksRequest request;
120
+ request.Program = " --\r\n SELECT\n 1\n ;\n\n SELECT\n 2\n ;\n " ;
121
+ request.Syntax = ESyntax::YQL;
122
+ request.Filters .ConstructInPlace ();
123
+ request.Filters ->push_back (TCheckFilter{.CheckNameGlob = " format" });
124
+ auto res = RunChecks (request);
125
+ UNIT_ASSERT_VALUES_EQUAL (res.Checks .size (), 1 );
126
+ UNIT_ASSERT_VALUES_EQUAL (res.Checks [0 ].CheckName , " format" );
127
+ UNIT_ASSERT_C (res.Checks [0 ].Success , res.Checks [0 ].Issues .ToString ());
128
+ UNIT_ASSERT_VALUES_EQUAL (res.Checks [0 ].Issues .Size (), 0 );
129
+ }
130
+
118
131
Y_UNIT_TEST (UnparsedFormatYql) {
119
132
TChecksRequest request;
120
133
request.Program = " select1\n " ;
You can’t perform that action at this time.
0 commit comments