From 4459fc3519cbc673bf0bfefe22b232f36b900e14 Mon Sep 17 00:00:00 2001 From: jangko Date: Thu, 5 Aug 2021 18:44:07 +0700 Subject: [PATCH] add more networkid cli test --- tests/test_misc.nim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/test_misc.nim b/tests/test_misc.nim index 59870452f..ba58327f5 100644 --- a/tests/test_misc.nim +++ b/tests/test_misc.nim @@ -25,9 +25,9 @@ proc miscMain*() = check toAddress(0x10, 0x0).toInt == 0x1000 check toAddress(0x10, 0x0, 0x0).toInt == 0x100000 + const genesisFile = "tests" / "customgenesis" / "calaveras.json" test "networkid cli": var msg: string - const genesisFile = "tests" / "customgenesis" / "calaveras.json" var opt = initOptParser("--customnetwork:" & genesisFile & " --networkid:123") let res = processArguments(msg, opt) if res != Success: @@ -37,5 +37,16 @@ proc miscMain*() = let conf = getConfiguration() check conf.net.networkId == 123.NetworkId + test "networkid first, customnetwork next": + var msg: string + var opt = initOptParser(" --networkid:123 --customnetwork:" & genesisFile) + let res = processArguments(msg, opt) + if res != Success: + echo msg + quit(QuitFailure) + + let conf = getConfiguration() + check conf.net.networkId == 123.NetworkId + when isMainModule: miscMain()