Oops, isMainModule will not run of course for all_tests (#841)

This commit is contained in:
Kim De Mey 2021-09-21 18:38:08 +02:00 committed by GitHub
parent 1afdfdf2ff
commit 0135189e4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 25 deletions

View File

@ -1,8 +1,8 @@
# Nimbus
# Copyright (c) 2018-2019 Status Research & Development GmbH
# Licensed under either of
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
# Nimbus - Fluffy
# Copyright (c) 2021 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import
@ -52,23 +52,18 @@ let wrongArrayElement =
]
"""
proc bridgeParserMain*() =
suite "Bridge client parser suite":
test "Parsing valid bridge_getBlockWitness response":
let asJson = parseJson(validResponse)
let parseResult = parseWitness(asJson)
check parseResult.isOk()
let sequenceResult = parseResult.get()
check sequenceResult.len() == 19
test "Parsing invalid bridge_getBlockWitness with wrong top type":
let asJson = parseJson(wronRespType)
let parseResult = parseWitness(asJson)
check parseResult.isErr()
test "Parsing invalid bridge_getBlockWitness with wrong array element":
let asJson = parseJson(wrongArrayElement)
let parseResult = parseWitness(asJson)
check parseResult.isErr()
when isMainModule:
bridgeParserMain()
suite "Bridge client parser suite":
test "Parsing valid bridge_getBlockWitness response":
let asJson = parseJson(validResponse)
let parseResult = parseWitness(asJson)
check parseResult.isOk()
let sequenceResult = parseResult.get()
check sequenceResult.len() == 19
test "Parsing invalid bridge_getBlockWitness with wrong top type":
let asJson = parseJson(wronRespType)
let parseResult = parseWitness(asJson)
check parseResult.isErr()
test "Parsing invalid bridge_getBlockWitness with wrong array element":
let asJson = parseJson(wrongArrayElement)
let parseResult = parseWitness(asJson)
check parseResult.isErr()