  @Test
  public void testLabelValuesEscaped() throws IOException {

    Gauge labels = Gauge.build().name("labels").help("help").labelNames("l").register(registry);
    labels.labels("ąćčęntěd a\nb\\c\"d").inc();
    TextFormat.write004(writer, registry.metricFamilySamples());
    assertEquals("# HELP labels help\n"
                 + "# TYPE labels gauge\n"
                 + "labels{l=\"ąćčęntěd a\\nb\\\\c\\\"d\",} 1.0\n", writer.toString());
  }