mirror of
https://git.ipng.ch/ipng/golang-cli.git
synced 2026-06-15 15:25:51 +00:00
21 lines
587 B
Go
21 lines
587 B
Go
// SPDX-FileCopyrightText: (C) Copyright 2026 Pim van Pelt <[email protected]>
|
|||
|
|
// SPDX-License-Identifier: Apache-2.0
|
||
|
|
|
||
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
cli "git.ipng.ch/ipng/golang-cli"
|
||
|
|
)
|
||
|
|
|
||
|
|
// TestTreeValid keeps the example's command tree free of the authoring faults
|
||
|
|
// Validate checks for. It doubles as the recommended way to use Validate: from
|
||
|
|
// a unit test, so a malformed tree fails the build rather than misdispatching
|
||
|
|
// at runtime.
|
||
|
|
func TestTreeValid(t *testing.T) {
|
||
|
|
if err := cli.Validate(buildTree()); err != nil {
|
||
|
|
t.Fatalf("buildTree() has authoring faults:\n%v", err)
|
||
|
|
}
|
||
|
|
}
|