File: nonce_test.go

package info (click to toggle)
golang-github-eggsampler-acme 3.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 312 kB
  • sloc: makefile: 47
file content (27 lines) | stat: -rw-r--r-- 480 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package acme

import (
	"testing"
)

func TestNonceStack(t *testing.T) {
	ns := nonceStack{}

	ns.push("test")
	if len(ns.stack) != 1 {
		t.Fatalf("expected stack size of 1, got: %d", len(ns.stack))
	}

	nonce := ns.pop()
	if nonce != "test" {
		t.Fatalf("bad nonce returned from stack, expected %q got %q", "test", nonce)
	}

	if nonce := ns.pop(); nonce != "" {
		t.Fatalf("expected no nonce, got: %v", nonce)
	}

	if len(ns.stack) != 0 {
		t.Fatal("expected empty stack")
	}
}