tordam

A library for peer discovery inside the Tor network
git clone https://git.parazyd.org/tordam
Log | Files | Refs | README | LICENSE

commit 7b6b654a957562857bbfd910ff957ea3883f5fa6
parent 2b8a308d0f5d12be61cc505687f6fe64d13aca92
Author: parazyd <parazyd@dyne.org>
Date:   Mon, 29 Oct 2018 17:53:21 +0100

Add zenroom.go test unit.

Diffstat:
Apkg/damlib/zenroom_test.go | 49+++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+), 0 deletions(-)

diff --git a/pkg/damlib/zenroom_test.go b/pkg/damlib/zenroom_test.go @@ -0,0 +1,49 @@ +package damlib + +/* + * Copyright (c) 2018 Dyne.org Foundation + * tor-dam is written and maintained by Ivan J. <parazyd@dyne.org> + * + * This file is part of tor-dam + * + * This source code is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this source code. If not, see <http://www.gnu.org/licenses/>. + */ + +import ( + "testing" +) + +func TestZenroomExec(t *testing.T) { + ret := ZenroomExec(`print ("hello")`, "", "", "", 1) + if ret != 0 { + t.Fatal("ZenroomExec returned:", ret) + } + + t.Log("ZenroomExec returned:", ret) +} + +func TestZenroomExecToBuf(t *testing.T) { + ret, stdout, _ := ZenroomExecToBuf(`print ("hello")`, "", "", "", 1) + if ret != 0 { + t.Fatal("ZenroomExec returned:", ret) + } + + if string(stdout) != "hello" { + t.Log("ZenroomExecToBuf stdout is not 'hello'") + t.Log("Stdout is rather", string(stdout)) + t.Fatal("ZenroomExecToBuf returned:", ret) + } + + t.Log("ZenroomExecToBuf returned:", ret) +}