@@ -54,9 +54,9 @@ posix_file_io_error generic_file_io_error = {EIO};
54
54
#endif
55
55
56
56
string8 make_message (string8_view content) {
57
- return string8 (u8" Content-Length: " ) +
58
- to_string8 (std::to_string (content.size ())) + u8" \r\n\r\n " +
59
- string8 ( content);
57
+ return concat (u8" Content-Length: " _sv,
58
+ to_string8_view (std::to_string (content.size ())),
59
+ u8" \r\n\r\n " _sv, content);
60
60
}
61
61
62
62
class mock_lsp_linter final : public lsp_linter {
@@ -130,13 +130,13 @@ class test_linting_lsp_server : public ::testing::Test, public filesystem_test {
130
130
131
131
std::string config_file_load_error_message (const char * js_path,
132
132
const char * error_path) {
133
- return " Failed to load configuration file for " s +
134
- this ->fs .rooted (js_path).path () +
135
- " . " s
136
- " Using default configuration.\n " s
137
- " Error details: failed to read from " s +
138
- this ->fs .rooted (error_path).path () + " : " s +
139
- generic_file_io_error.to_string ();
133
+ return concat ( " Failed to load configuration file for " ,
134
+ this ->fs .rooted (js_path).path (),
135
+ " . "
136
+ " Using default configuration.\n "
137
+ " Error details: failed to read from " ,
138
+ this ->fs .rooted (error_path).path (), " : " ,
139
+ generic_file_io_error.to_string () );
140
140
}
141
141
};
142
142
@@ -1070,8 +1070,8 @@ TEST_F(test_linting_lsp_server, editing_config_relints_open_js_file) {
1070
1070
if (config.globals ().find (u8" after" _sv)) {
1071
1071
EXPECT_FALSE (config.globals ().find (u8" before" _sv));
1072
1072
EXPECT_EQ (version_json, u8" 10" );
1073
- EXPECT_EQ (uri_json,
1074
- u8" \" " + this -> fs . file_uri_prefix_8 () + u8" test.js\" " );
1073
+ EXPECT_EQ (uri_json, concat ( u8" \" " _sv, this -> fs . file_uri_prefix_8 (),
1074
+ u8" test.js\" " _sv) );
1075
1075
after_config_was_loaded = true ;
1076
1076
}
1077
1077
};
@@ -1232,21 +1232,21 @@ TEST_F(test_linting_lsp_server, editing_config_relints_many_open_js_files) {
1232
1232
outgoing_lsp_message_queue& outgoing_messages) {
1233
1233
byte_buffer& notification_json = outgoing_messages.new_message ();
1234
1234
notification_json.append_copy (
1235
- u8R"(
1235
+ concat ( u8R"(
1236
1236
{
1237
1237
"method": "textDocument/publishDiagnostics",
1238
1238
"params":{
1239
- "uri": )" +
1240
- string8 (uri_json) +
1241
- u8R"( ,
1242
- "version": )" +
1243
- string8 (version_json) +
1244
- u8R"( ,
1239
+ "uri": )" _sv,
1240
+ uri_json,
1241
+ u8R"( ,
1242
+ "version": )" _sv,
1243
+ version_json,
1244
+ u8R"( ,
1245
1245
"diagnostics": []
1246
1246
},
1247
1247
"jsonrpc":"2.0"
1248
1248
}
1249
- )" );
1249
+ )" _sv) );
1250
1250
};
1251
1251
1252
1252
this ->fs .create_file (this ->fs .rooted (" quick-lint-js.config" ),
@@ -1345,21 +1345,21 @@ TEST_F(test_linting_lsp_server, editing_config_relints_only_affected_js_files) {
1345
1345
outgoing_lsp_message_queue& outgoing_messages) {
1346
1346
byte_buffer& notification_json = outgoing_messages.new_message ();
1347
1347
notification_json.append_copy (
1348
- u8R"(
1348
+ concat ( u8R"(
1349
1349
{
1350
1350
"method": "textDocument/publishDiagnostics",
1351
1351
"params":{
1352
- "uri": )" +
1353
- string8 (uri_json) +
1354
- u8R"( ,
1355
- "version": )" +
1356
- string8 (version_json) +
1357
- u8R"( ,
1352
+ "uri": )" _sv,
1353
+ uri_json,
1354
+ u8R"( ,
1355
+ "version": )" _sv,
1356
+ version_json,
1357
+ u8R"( ,
1358
1358
"diagnostics": []
1359
1359
},
1360
1360
"jsonrpc":"2.0"
1361
1361
}
1362
- )" );
1362
+ )" _sv) );
1363
1363
};
1364
1364
1365
1365
this ->server ->append (
@@ -1559,8 +1559,8 @@ TEST_F(test_linting_lsp_server, opening_config_relints_open_js_files) {
1559
1559
if (config.globals ().find (u8" after" _sv)) {
1560
1560
EXPECT_FALSE (config.globals ().find (u8" before" _sv));
1561
1561
EXPECT_EQ (version_json, u8" 10" );
1562
- EXPECT_EQ (uri_json,
1563
- u8" \" " + this -> fs . file_uri_prefix_8 () + u8" test.js\" " );
1562
+ EXPECT_EQ (uri_json, concat ( u8" \" " _sv, this -> fs . file_uri_prefix_8 (),
1563
+ u8" test.js\" " _sv) );
1564
1564
after_config_was_loaded = true ;
1565
1565
}
1566
1566
};
@@ -1629,22 +1629,23 @@ TEST_F(test_linting_lsp_server,
1629
1629
EXPECT_TRUE (config.globals ().find (u8" after" _sv));
1630
1630
EXPECT_FALSE (config.globals ().find (u8" before" _sv));
1631
1631
EXPECT_EQ (version_json, u8" 10" );
1632
- EXPECT_EQ (uri_json, u8" \" " + this ->fs .file_uri_prefix_8 () + u8" test.js\" " );
1632
+ EXPECT_EQ (uri_json, concat (u8" \" " _sv, this ->fs .file_uri_prefix_8 (),
1633
+ u8" test.js\" " _sv));
1633
1634
after_config_was_loaded = true ;
1634
1635
1635
1636
byte_buffer& notification_json = outgoing_messages.new_message ();
1636
1637
notification_json.append_copy (
1637
- u8R"( {
1638
+ concat ( u8R"( {
1638
1639
"method": "textDocument/publishDiagnostics",
1639
1640
"params": {
1640
- "uri": ")" +
1641
- this ->fs .file_uri_prefix_8 () +
1642
- u8R"( test.js",
1641
+ "uri": ")" _sv,
1642
+ this ->fs .file_uri_prefix_8 (),
1643
+ u8R"( test.js",
1643
1644
"version": 10,
1644
1645
"diagnostics": []
1645
1646
},
1646
1647
"jsonrpc": "2.0"
1647
- })" );
1648
+ })" _sv) );
1648
1649
};
1649
1650
this ->client ->messages .clear ();
1650
1651
@@ -1763,17 +1764,17 @@ TEST_F(test_linting_lsp_server,
1763
1764
EXPECT_FALSE (config.globals ().find (u8" configFromLSP" _sv));
1764
1765
byte_buffer& notification_json = outgoing_messages.new_message ();
1765
1766
notification_json.append_copy (
1766
- u8R"( {
1767
+ concat ( u8R"( {
1767
1768
"method": "textDocument/publishDiagnostics",
1768
1769
"params": {
1769
- "uri": ")" +
1770
- this ->fs .file_uri_prefix_8 () +
1771
- u8R"( test.js",
1770
+ "uri": ")" _sv,
1771
+ this ->fs .file_uri_prefix_8 (),
1772
+ u8R"( test.js",
1772
1773
"version": 10,
1773
1774
"diagnostics": []
1774
1775
},
1775
1776
"jsonrpc": "2.0"
1776
- })" );
1777
+ })" _sv) );
1777
1778
};
1778
1779
this ->server ->append (
1779
1780
make_message (concat (u8R"( {
@@ -1810,19 +1811,19 @@ TEST_F(test_linting_lsp_server, opening_js_file_with_unreadable_config_lints) {
1810
1811
<< " config should be default" ;
1811
1812
byte_buffer& notification_json = outgoing_messages.new_message ();
1812
1813
notification_json.append_copy (
1813
- u8R"( {
1814
+ concat ( u8R"( {
1814
1815
"method": "textDocument/publishDiagnostics",
1815
1816
"params": {
1816
- "uri": )" +
1817
- string8 (uri_json) +
1818
- u8R"( ,
1819
- "version": )" +
1820
- string8 (version_json) +
1821
- u8R"( ,
1817
+ "uri": )" _sv,
1818
+ uri_json,
1819
+ u8R"( ,
1820
+ "version": )" _sv,
1821
+ version_json,
1822
+ u8R"( ,
1822
1823
"diagnostics": []
1823
1824
},
1824
1825
"jsonrpc": "2.0"
1825
- })" );
1826
+ })" _sv) );
1826
1827
};
1827
1828
1828
1829
this ->server ->append (
@@ -1873,19 +1874,19 @@ TEST_F(test_linting_lsp_server,
1873
1874
<< " config should be default" ;
1874
1875
byte_buffer& notification_json = outgoing_messages.new_message ();
1875
1876
notification_json.append_copy (
1876
- u8R"( {
1877
+ concat ( u8R"( {
1877
1878
"method": "textDocument/publishDiagnostics",
1878
1879
"params": {
1879
- "uri": )" +
1880
- string8 (uri_json) +
1881
- u8R"( ,
1882
- "version": )" +
1883
- string8 (version_json) +
1884
- u8R"( ,
1880
+ "uri": )" _sv,
1881
+ uri_json,
1882
+ u8R"( ,
1883
+ "version": )" _sv,
1884
+ version_json,
1885
+ u8R"( ,
1885
1886
"diagnostics": []
1886
1887
},
1887
1888
"jsonrpc": "2.0"
1888
- })" );
1889
+ })" _sv) );
1889
1890
};
1890
1891
1891
1892
this ->server ->append (
@@ -1919,9 +1920,9 @@ TEST_F(test_linting_lsp_server,
1919
1920
lsp_warning_message_type);
1920
1921
EXPECT_EQ (look_up (showMessageMessage, " params" , " message" ),
1921
1922
to_boost_string_view (
1922
- " Problems found in the config file for " s +
1923
- this ->fs .rooted (" test.js" ).c_str () + " (" +
1924
- this ->fs .rooted (" quick-lint-js.config" ).c_str () + " )." ));
1923
+ concat ( " Problems found in the config file for " ,
1924
+ this ->fs .rooted (" test.js" ).path (), " (" ,
1925
+ this ->fs .rooted (" quick-lint-js.config" ).path (), " )." ) ));
1925
1926
}
1926
1927
1927
1928
TEST_F (test_linting_lsp_server, making_config_file_unreadable_relints) {
@@ -1960,19 +1961,19 @@ TEST_F(test_linting_lsp_server, making_config_file_unreadable_relints) {
1960
1961
<< " config should be default" ;
1961
1962
byte_buffer& notification_json = outgoing_messages.new_message ();
1962
1963
notification_json.append_copy (
1963
- u8R"( {
1964
+ concat ( u8R"( {
1964
1965
"method": "textDocument/publishDiagnostics",
1965
1966
"params": {
1966
- "uri": )" +
1967
- string8 (uri_json) +
1968
- u8R"( ,
1969
- "version": )" +
1970
- string8 (version_json) +
1971
- u8R"( ,
1967
+ "uri": )" _sv,
1968
+ uri_json,
1969
+ u8R"( ,
1970
+ "version": )" _sv,
1971
+ version_json,
1972
+ u8R"( ,
1972
1973
"diagnostics": []
1973
1974
},
1974
1975
"jsonrpc": "2.0"
1975
- })" );
1976
+ })" _sv) );
1976
1977
};
1977
1978
this ->client ->messages .clear ();
1978
1979
this ->handler ->filesystem_changed ();
0 commit comments