@@ -54,9 +54,9 @@ posix_file_io_error generic_file_io_error = {EIO};
5454#endif
5555
5656string8 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);
6060}
6161
6262class mock_lsp_linter final : public lsp_linter {
@@ -130,13 +130,13 @@ class test_linting_lsp_server : public ::testing::Test, public filesystem_test {
130130
131131 std::string config_file_load_error_message (const char * js_path,
132132 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 () );
140140 }
141141};
142142
@@ -1070,8 +1070,8 @@ TEST_F(test_linting_lsp_server, editing_config_relints_open_js_file) {
10701070 if (config.globals ().find (u8" after" _sv)) {
10711071 EXPECT_FALSE (config.globals ().find (u8" before" _sv));
10721072 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) );
10751075 after_config_was_loaded = true ;
10761076 }
10771077 };
@@ -1232,21 +1232,21 @@ TEST_F(test_linting_lsp_server, editing_config_relints_many_open_js_files) {
12321232 outgoing_lsp_message_queue& outgoing_messages) {
12331233 byte_buffer& notification_json = outgoing_messages.new_message ();
12341234 notification_json.append_copy (
1235- u8R"(
1235+ concat ( u8R"(
12361236 {
12371237 "method": "textDocument/publishDiagnostics",
12381238 "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"( ,
12451245 "diagnostics": []
12461246 },
12471247 "jsonrpc":"2.0"
12481248 }
1249- )" );
1249+ )" _sv) );
12501250 };
12511251
12521252 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) {
13451345 outgoing_lsp_message_queue& outgoing_messages) {
13461346 byte_buffer& notification_json = outgoing_messages.new_message ();
13471347 notification_json.append_copy (
1348- u8R"(
1348+ concat ( u8R"(
13491349 {
13501350 "method": "textDocument/publishDiagnostics",
13511351 "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"( ,
13581358 "diagnostics": []
13591359 },
13601360 "jsonrpc":"2.0"
13611361 }
1362- )" );
1362+ )" _sv) );
13631363 };
13641364
13651365 this ->server ->append (
@@ -1559,8 +1559,8 @@ TEST_F(test_linting_lsp_server, opening_config_relints_open_js_files) {
15591559 if (config.globals ().find (u8" after" _sv)) {
15601560 EXPECT_FALSE (config.globals ().find (u8" before" _sv));
15611561 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) );
15641564 after_config_was_loaded = true ;
15651565 }
15661566 };
@@ -1629,22 +1629,23 @@ TEST_F(test_linting_lsp_server,
16291629 EXPECT_TRUE (config.globals ().find (u8" after" _sv));
16301630 EXPECT_FALSE (config.globals ().find (u8" before" _sv));
16311631 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));
16331634 after_config_was_loaded = true ;
16341635
16351636 byte_buffer& notification_json = outgoing_messages.new_message ();
16361637 notification_json.append_copy (
1637- u8R"( {
1638+ concat ( u8R"( {
16381639 "method": "textDocument/publishDiagnostics",
16391640 "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",
16431644 "version": 10,
16441645 "diagnostics": []
16451646 },
16461647 "jsonrpc": "2.0"
1647- })" );
1648+ })" _sv) );
16481649 };
16491650 this ->client ->messages .clear ();
16501651
@@ -1763,17 +1764,17 @@ TEST_F(test_linting_lsp_server,
17631764 EXPECT_FALSE (config.globals ().find (u8" configFromLSP" _sv));
17641765 byte_buffer& notification_json = outgoing_messages.new_message ();
17651766 notification_json.append_copy (
1766- u8R"( {
1767+ concat ( u8R"( {
17671768 "method": "textDocument/publishDiagnostics",
17681769 "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",
17721773 "version": 10,
17731774 "diagnostics": []
17741775 },
17751776 "jsonrpc": "2.0"
1776- })" );
1777+ })" _sv) );
17771778 };
17781779 this ->server ->append (
17791780 make_message (concat (u8R"( {
@@ -1810,19 +1811,19 @@ TEST_F(test_linting_lsp_server, opening_js_file_with_unreadable_config_lints) {
18101811 << " config should be default" ;
18111812 byte_buffer& notification_json = outgoing_messages.new_message ();
18121813 notification_json.append_copy (
1813- u8R"( {
1814+ concat ( u8R"( {
18141815 "method": "textDocument/publishDiagnostics",
18151816 "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"( ,
18221823 "diagnostics": []
18231824 },
18241825 "jsonrpc": "2.0"
1825- })" );
1826+ })" _sv) );
18261827 };
18271828
18281829 this ->server ->append (
@@ -1873,19 +1874,19 @@ TEST_F(test_linting_lsp_server,
18731874 << " config should be default" ;
18741875 byte_buffer& notification_json = outgoing_messages.new_message ();
18751876 notification_json.append_copy (
1876- u8R"( {
1877+ concat ( u8R"( {
18771878 "method": "textDocument/publishDiagnostics",
18781879 "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"( ,
18851886 "diagnostics": []
18861887 },
18871888 "jsonrpc": "2.0"
1888- })" );
1889+ })" _sv) );
18891890 };
18901891
18911892 this ->server ->append (
@@ -1919,9 +1920,9 @@ TEST_F(test_linting_lsp_server,
19191920 lsp_warning_message_type);
19201921 EXPECT_EQ (look_up (showMessageMessage, " params" , " message" ),
19211922 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 (), " )." ) ));
19251926}
19261927
19271928TEST_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) {
19601961 << " config should be default" ;
19611962 byte_buffer& notification_json = outgoing_messages.new_message ();
19621963 notification_json.append_copy (
1963- u8R"( {
1964+ concat ( u8R"( {
19641965 "method": "textDocument/publishDiagnostics",
19651966 "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"( ,
19721973 "diagnostics": []
19731974 },
19741975 "jsonrpc": "2.0"
1975- })" );
1976+ })" _sv) );
19761977 };
19771978 this ->client ->messages .clear ();
19781979 this ->handler ->filesystem_changed ();
0 commit comments