rich_location *richloc,
diagnostic_t diagnostic_kind)
{
- pp_newline (context->printer);
-
location_t loc = richloc->get_loc ();
/* Do nothing if source-printing has been disabled. */
if (!context->show_caret)
test_diagnostic_context dc;
rich_location richloc (line_table, UNKNOWN_LOCATION);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n", pp_formatted_text (dc.printer));
+ ASSERT_STREQ ("", pp_formatted_text (dc.printer));
}
/* Verify that diagnostic_show_locus works sanely for various
location_t caret = linemap_position_for_column (line_table, 10);
rich_location richloc (line_table, caret);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^\n",
pp_formatted_text (dc.printer));
}
location_t loc = make_location (caret, start, finish);
rich_location richloc (line_table, loc);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ~~~^~~~~~\n",
pp_formatted_text (dc.printer));
}
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
richloc.add_range (field, SHOW_RANGE_WITH_CARET);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ~A~ ~B~ ~~C~~\n",
pp_formatted_text (dc.printer));
}
rich_location richloc (line_table, caret);
richloc.add_fixit_insert_before ("&");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^\n"
" &\n",
pp_formatted_text (dc.printer));
rich_location richloc (line_table, foo);
richloc.add_fixit_insert_after ("[0]");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~\n"
" [0]\n",
pp_formatted_text (dc.printer));
{
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~~~~\n"
" ------\n",
pp_formatted_text (dc.printer));
pp_prefixing_rule (dc.printer) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.printer, xstrdup ("TEST PREFIX:"));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- "TEST PREFIX: foo = bar.field;\n"
+ ASSERT_STREQ ("TEST PREFIX: foo = bar.field;\n"
"TEST PREFIX: ^~~~~~\n"
"TEST PREFIX: ------\n",
pp_formatted_text (dc.printer));
dc.show_ruler_p = true;
dc.caret_max_width = 104;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " 0 0 0 0 0 0 0 0 0 1 \n"
+ ASSERT_STREQ (" 0 0 0 0 0 0 0 0 0 1 \n"
" 1 2 3 4 5 6 7 8 9 0 \n"
" 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\n"
" foo = bar.field;\n"
pp_prefixing_rule (dc.printer) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.printer, xstrdup ("TEST PREFIX:"));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- "TEST PREFIX: 1 2 3 4 5\n"
+ ASSERT_STREQ ("TEST PREFIX: 1 2 3 4 5\n"
"TEST PREFIX: 12345678901234567890123456789012345678901234567890\n"
"TEST PREFIX: foo = bar.field;\n"
"TEST PREFIX: ^~~~~~\n"
pp_prefixing_rule (dc.printer) = DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE;
pp_set_prefix (dc.printer, xstrdup ("TEST PREFIX:"));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- "TEST PREFIX: | 1 2 3 4 5\n"
+ ASSERT_STREQ ("TEST PREFIX: | 1 2 3 4 5\n"
"TEST PREFIX: | 12345678901234567890123456789012345678901234567890\n"
"TEST PREFIX: 1 | foo = bar.field;\n"
"TEST PREFIX: | ^~~~~~\n"
rich_location richloc (line_table, field);
richloc.add_fixit_replace ("m_field");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~~~\n"
" m_field\n",
pp_formatted_text (dc.printer));
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* The replacement range is not indicated in the annotation line, so
it should be indicated via an additional underline. */
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^\n"
" -----\n"
" m_field\n",
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* The replacement range is indicated in the annotation line,
so it shouldn't be indicated via an additional underline. */
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^ ~~~~~\n"
" m_field\n",
pp_formatted_text (dc.printer));
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~~~~~~~~ \n"
" test\n",
pp_formatted_text (dc.printer));
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~~~~~~~~ \n"
" -----------------------------------------\n",
pp_formatted_text (dc.printer));
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~~~~~~~~ \n"
" test\n",
pp_formatted_text (dc.printer));
richloc.add_fixit_insert_before ("a");
ASSERT_EQ (1, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^\n"
" aaaaaaaaaaaaaaaaaaa\n",
pp_formatted_text (dc.printer));
}
ASSERT_EQ (19, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^\n"
"a a a a a a a a a a a a a a a a a a a\n",
pp_formatted_text (dc.printer));
{
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n"
" | | |\n"
" 0 1 2\n",
test_diagnostic_context dc;
dc.show_labels_p = false;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n",
pp_formatted_text (dc.printer));
}
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n"
" | | |\n"
" | | label 2\n"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~ ~~~ ~~~~~\n"
" | | |\n"
" | | c\n"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ~~~ ~~~ ^~~~~\n"
" | | |\n"
" 2 1 0\n",
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~\n"
" |\n"
" label 0\n"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ~~~ ~~~ ^~~~~\n"
" | | |\n"
" | | label 0a\n"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar.field;\n"
+ ASSERT_STREQ (" foo = bar.field;\n"
" ^~~\n",
pp_formatted_text (dc.printer));
}
location_t caret = linemap_position_for_column (line_table, 18);
rich_location richloc (line_table, caret);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
location_t loc = make_location (caret, start, finish);
rich_location richloc (line_table, loc);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
richloc.add_range (bar, SHOW_RANGE_WITH_CARET);
richloc.add_range (field, SHOW_RANGE_WITH_CARET);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
rich_location richloc (line_table, caret);
richloc.add_fixit_insert_before ("&");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
rich_location richloc (line_table, foo);
richloc.add_fixit_insert_after ("[0]");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
rich_location richloc (line_table, dot);
richloc.add_fixit_remove ();
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
rich_location richloc (line_table, field);
richloc.add_fixit_replace ("m_\xf0\x9f\x98\x82_field\xcf\x80");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* The replacement range is not indicated in the annotation line, so
it should be indicated via an additional underline. */
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
/* The replacement range is indicated in the annotation line,
so it shouldn't be indicated via an additional underline. */
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
richloc.add_fixit_insert_before (i & 1 ? "@" : "\xcf\x80");
ASSERT_EQ (1, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
ASSERT_EQ (nlocs, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
{
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " \xf0\x9f\x98\x82"
+ ASSERT_STREQ (" \xf0\x9f\x98\x82"
"_foo = \xcf\x80"
"_bar.\xf0\x9f\x98\x82"
"_field\xcf\x80"
ASSERT_EQ (2, richloc.get_num_locations ());
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " struct same_line { double x; double y; ;\n"
+ ASSERT_STREQ (" struct same_line { double x; double y; ;\n"
" ~ ^\n",
pp_formatted_text (dc.printer));
}
richloc.add_fixit_insert_before (x, ".");
richloc.add_fixit_replace (colon, "=");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " struct point origin = {x: 0.0,\n"
+ ASSERT_STREQ (" struct point origin = {x: 0.0,\n"
" ^\n"
" .=\n",
pp_formatted_text (dc.printer));
richloc.add_fixit_insert_before (y, ".");
richloc.add_fixit_replace (colon, "=");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- "FILENAME:3:24:\n"
+ ASSERT_STREQ ("FILENAME:3:24:\n"
" y\n"
" .\n"
"FILENAME:6:25:\n"
test_diagnostic_context dc;
dc.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " 3 | y\n"
+ ASSERT_STREQ (" 3 | y\n"
" | .\n"
"......\n"
" 6 | : 0.0};\n"
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -----------------\n"
" const_cast<foo *> (ptr->field)\n",
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -\n"
" CAST (-\n"
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -\n"
" CST ( -\n"
ASSERT_EQ (1, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -------\n"
" (bar *)\n",
/* But the corrections are. */
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -----------------\n"
" (longer *)(foo *)\n",
it would overlap with the second.
Verify that they are printed as a single replacement. */
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo *f = (foo *)ptr->field;\n"
+ ASSERT_STREQ (" foo *f = (foo *)ptr->field;\n"
" ^~~~~~~~~~\n"
" -------\n"
" LONGER THAN THE CAST(foo *)TEST\n",
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
richloc.add_fixit_insert_after (")");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
ASSERT_EQ (1, richloc.get_num_fixit_hints ());
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
/* But the corrections are. */
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
it would overlap with the second.
Verify that they are printed as a single replacement. */
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " f\xf0\x9f\x98\x82"
+ ASSERT_STREQ (" f\xf0\x9f\x98\x82"
" *f = (f\xf0\x9f\x98\x82"
" *)ptr->field\xcf\x80"
";\n"
/* Verify that they're printed correctly. */
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " int a5[][0][0] = { 1, 2 };\n"
+ ASSERT_STREQ (" int a5[][0][0] = { 1, 2 };\n"
" ^\n"
" } {\n",
pp_formatted_text (dc.printer));
richloc.add_fixit_insert_before (col_1, "{");
richloc.add_fixit_insert_before (col_25, "}");
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " int a5[][0][0] = { 1, 2 };\n"
+ ASSERT_STREQ (" int a5[][0][0] = { 1, 2 };\n"
" ^\n"
" { -----\n"
" {{1}}}}, {{{2 }}\n",
{
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " x = a;\n"
+ ASSERT_STREQ (" x = a;\n"
"+ break;\n"
" case 'b':\n"
" ^~~~~~~~~\n",
test_diagnostic_context dc;
dc.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " 2 | x = a;\n"
+ ASSERT_STREQ (" 2 | x = a;\n"
" +++ |+ break;\n"
" 3 | case 'b':\n"
" | ^~~~~~~~~\n",
ASSERT_TRUE (richloc.seen_impossible_fixit_p ());
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " case 'b':\n"
+ ASSERT_STREQ (" case 'b':\n"
" ^~~~~~~~~\n",
pp_formatted_text (dc.printer));
}
{
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- "FILENAME:1:1:\n"
+ ASSERT_STREQ ("FILENAME:1:1:\n"
"+#include <stdio.h>\n"
" test (int ch)\n"
"FILENAME:3:2:\n"
test_diagnostic_context dc;
dc.show_line_numbers_p = true;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " +++ |+#include <stdio.h>\n"
+ ASSERT_STREQ (" +++ |+#include <stdio.h>\n"
" 1 | test (int ch)\n"
" 2 | {\n"
" 3 | putchar (ch);\n"
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar ();\n"
+ ASSERT_STREQ (" foo = bar ();\n"
" ^\n",
pp_formatted_text (dc.printer));
}
test_diagnostic_context dc;
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " foo = bar (\n"
+ ASSERT_STREQ (" foo = bar (\n"
" ~^\n"
" );\n"
" ~ \n",
dc.min_margin_width = 0;
gcc_rich_location richloc (loc);
diagnostic_show_locus (&dc, &richloc, DK_ERROR);
- ASSERT_STREQ ("\n"
- " 9 | this is line 9\n"
+ ASSERT_STREQ (" 9 | this is line 9\n"
" | ~~~~~~\n"
"10 | this is line 10\n"
" | ~~~~~^~~~~~~~~~\n"