Use raw string literals in tests

This commit is contained in:
Bernerd Schaefer 2013-04-19 13:29:24 +02:00
parent 0b30e065c8
commit 3433b798b3
3 changed files with 20 additions and 20 deletions

View File

@ -28,7 +28,7 @@ func testCounter(t tester) {
steps: []func(g Counter){},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[]}",
value: `{"type":"counter","value":[]}`,
},
},
{
@ -40,7 +40,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":1}]}",
value: `{"type":"counter","value":[{"labels":{},"value":1}]}`,
},
},
{
@ -52,7 +52,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":2}]}",
value: `{"type":"counter","value":[{"labels":{},"value":2}]}`,
},
},
{
@ -67,7 +67,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{},\"value\":5}]}",
value: `{"type":"counter","value":[{"labels":{},"value":5}]}`,
},
},
{
@ -85,7 +85,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[]}",
value: `{"type":"counter","value":[]}`,
},
},
{
@ -97,7 +97,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":19}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":19}]}`,
},
},
{
@ -112,7 +112,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":24}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":24}]}`,
},
},
{
@ -124,7 +124,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":1}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":1}]}`,
},
},
{
@ -136,7 +136,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":-1}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":-1}]}`,
},
},
{
@ -151,7 +151,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":28}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":28}]}`,
},
},
{
@ -166,7 +166,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":36}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":36}]}`,
},
},
{
@ -181,7 +181,7 @@ func testCounter(t tester) {
},
},
out: output{
value: "{\"type\":\"counter\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":27}]}",
value: `{"type":"counter","value":[{"labels":{"handler":"/foo"},"value":27}]}`,
},
},
}

View File

@ -28,7 +28,7 @@ func testGauge(t tester) {
steps: []func(g Gauge){},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[]}",
value: `{"type":"gauge","value":[]}`,
},
},
{
@ -40,7 +40,7 @@ func testGauge(t tester) {
},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":1}]}",
value: `{"type":"gauge","value":[{"labels":{},"value":1}]}`,
},
},
{
@ -52,7 +52,7 @@ func testGauge(t tester) {
},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":2}]}",
value: `{"type":"gauge","value":[{"labels":{},"value":2}]}`,
},
},
{
@ -67,7 +67,7 @@ func testGauge(t tester) {
},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{},\"value\":5}]}",
value: `{"type":"gauge","value":[{"labels":{},"value":5}]}`,
},
},
{
@ -85,7 +85,7 @@ func testGauge(t tester) {
},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[]}",
value: `{"type":"gauge","value":[]}`,
},
},
{
@ -97,7 +97,7 @@ func testGauge(t tester) {
},
},
out: output{
value: "{\"type\":\"gauge\",\"value\":[{\"labels\":{\"handler\":\"/foo\"},\"value\":19}]}",
value: `{"type":"gauge","value":[{"labels":{"handler":"/foo"},"value":19}]}`,
},
},
}

View File

@ -282,7 +282,7 @@ func testDumpToWriter(t tester) {
"foo": NewCounter(),
},
},
out: []byte("[{\"baseLabels\":{\"label_foo\":\"foo\",\"name\":\"foo\"},\"docstring\":\"metric foo\",\"metric\":{\"type\":\"counter\",\"value\":[]}}]"),
out: []byte(`[{"baseLabels":{"label_foo":"foo","name":"foo"},"docstring":"metric foo","metric":{"type":"counter","value":[]}}]`),
},
{
in: input{
@ -291,7 +291,7 @@ func testDumpToWriter(t tester) {
"bar": NewCounter(),
},
},
out: []byte("[{\"baseLabels\":{\"label_bar\":\"bar\",\"name\":\"bar\"},\"docstring\":\"metric bar\",\"metric\":{\"type\":\"counter\",\"value\":[]}},{\"baseLabels\":{\"label_foo\":\"foo\",\"name\":\"foo\"},\"docstring\":\"metric foo\",\"metric\":{\"type\":\"counter\",\"value\":[]}}]"),
out: []byte(`[{"baseLabels":{"label_bar":"bar","name":"bar"},"docstring":"metric bar","metric":{"type":"counter","value":[]}},{"baseLabels":{"label_foo":"foo","name":"foo"},"docstring":"metric foo","metric":{"type":"counter","value":[]}}]`),
},
}