From 5f796f90914f9e1b46173f3f6310ec4c17376141 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 21 Jul 2018 21:09:43 +0200 Subject: [PATCH] tests: don't check for exact "min: 1 %" formatting Only check that the output contains " 1 %". This keeps the tests working even if the formatting changes. --- tests/cli_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cli_test.go b/tests/cli_test.go index 91daa8e..d540972 100644 --- a/tests/cli_test.go +++ b/tests/cli_test.go @@ -73,18 +73,18 @@ func TestCli(t *testing.T) { {args: []string{"-p"}, code: -1, stdoutContains: memReport}, {args: []string{"-v"}, code: 0, stderrContains: "earlyoom v", stdoutEmpty: true}, {args: []string{"-d"}, code: -1, stdoutContains: "^ new victim (higher badness)"}, - {args: []string{"-m", "1"}, code: -1, stderrContains: "1 %", stdoutContains: memReport}, + {args: []string{"-m", "1"}, code: -1, stderrContains: " 1 %", stdoutContains: memReport}, {args: []string{"-m", "0"}, code: 15, stderrContains: "invalid percentage", stdoutEmpty: true}, {args: []string{"-m", "-10"}, code: 15, stderrContains: "invalid percentage", stdoutEmpty: true}, // Using "-m 100" makes no sense {args: []string{"-m", "100"}, code: 15, stderrContains: "invalid percentage", stdoutEmpty: true}, - {args: []string{"-s", "2"}, code: -1, stderrContains: "2 %", stdoutContains: memReport}, + {args: []string{"-s", "2"}, code: -1, stderrContains: " 2 %", stdoutContains: memReport}, // Using "-s 100" is a valid way to ignore swap usage - {args: []string{"-s", "100"}, code: -1, stderrContains: "100 %", stdoutContains: memReport}, + {args: []string{"-s", "100"}, code: -1, stderrContains: " 100 %", stdoutContains: memReport}, {args: []string{"-s", "101"}, code: 16, stderrContains: "invalid percentage", stdoutEmpty: true}, {args: []string{"-s", "0"}, code: 16, stderrContains: "invalid percentage", stdoutEmpty: true}, {args: []string{"-s", "-10"}, code: 16, stderrContains: "invalid percentage", stdoutEmpty: true}, - {args: []string{"-M", mem1percent}, code: -1, stderrContains: "min: 1 %", stdoutContains: memReport}, + {args: []string{"-M", mem1percent}, code: -1, stderrContains: " 1 %", stdoutContains: memReport}, {args: []string{"-M", "9999999999999999"}, code: 15, stderrContains: "at or above total memory", stdoutEmpty: true}, {args: []string{"-S", "9999999999999999"}, code: 16, stderrContains: "above total swap", stdoutEmpty: true}, {args: []string{"-r", "0"}, code: -1, stderrContains: startupMsg, stdoutEmpty: true}, @@ -98,7 +98,7 @@ func TestCli(t *testing.T) { } if swapTotal > 0 { // Test cannot work when there is no swap enabled - tc := cliTestCase{args: []string{"-S", swap2percent}, code: -1, stderrContains: "min: 2 %", stdoutContains: memReport} + tc := cliTestCase{args: []string{"-S", swap2percent}, code: -1, stderrContains: " 2 %", stdoutContains: memReport} testcases = append(testcases, tc) }