From 1c88667306e7a52d36a6a1cbf3eca86fd612bd7f Mon Sep 17 00:00:00 2001 From: Andrey Meshkov Date: Fri, 11 Sep 2020 13:21:37 +0300 Subject: [PATCH] * (home): added tests for no-mem-optimization flag --- home/options_test.go | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/home/options_test.go b/home/options_test.go index 5a2b1155..afaa873f 100644 --- a/home/options_test.go +++ b/home/options_test.go @@ -140,6 +140,15 @@ func TestParseDisableUpdate(t *testing.T) { } } +func TestParseDisableMemoryOptimization(t *testing.T) { + if testParseOk(t).disableMemoryOptimization { + t.Fatal("empty is not disable update") + } + if !testParseOk(t, "--no-mem-optimization").disableMemoryOptimization { + t.Fatal("--no-mem-optimization is disable update") + } +} + func TestParseService(t *testing.T) { if testParseOk(t).serviceControlAction != "" { t.Fatal("empty is no service command") @@ -226,12 +235,17 @@ func TestSerializeGLInet(t *testing.T) { testSerialize(t, options{glinetMode: true}, "--glinet") } +func TestSerializeDisableMemoryOptimization(t *testing.T) { + testSerialize(t, options{disableMemoryOptimization: true}, "--no-mem-optimization") +} + func TestSerializeMultiple(t *testing.T) { testSerialize(t, options{ - serviceControlAction: "run", - configFilename: "config", - workDir: "work", - pidFile: "pid", - disableUpdate: true, - }, "-c", "config", "-w", "work", "-s", "run", "--pidfile", "pid", "--no-check-update") + serviceControlAction: "run", + configFilename: "config", + workDir: "work", + pidFile: "pid", + disableUpdate: true, + disableMemoryOptimization: true, + }, "-c", "config", "-w", "work", "-s", "run", "--pidfile", "pid", "--no-check-update", "--no-mem-optimization") }