pkg.tk-software.de/gotice@v0.4.1-0.20240224130243-6adec687b106/help_test.go (about)

     1  // Copyright 2023-2024 Tobias Koch. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import "testing"
     8  
     9  func TestHelpCommand(t *testing.T) {
    10  	args := []string{
    11  		"param0",
    12  		"help",
    13  	}
    14  
    15  	if err := exec(args); err != nil {
    16  		t.Errorf("Expected no error, got %s", err)
    17  	}
    18  }
    19  
    20  func TestHelpCommandTopic(t *testing.T) {
    21  	tests := []struct {
    22  		name string
    23  		args []string
    24  	}{
    25  		{"init-usage", []string{"param0", "help", "init"}},
    26  		{"generate-usage", []string{"param0", "help", "generate"}},
    27  		{"version-usage", []string{"param0", "help", "version"}},
    28  		{"help-usage", []string{"param0", "help", "help"}},
    29  	}
    30  
    31  	for _, test := range tests {
    32  		t.Run(test.name, func(t *testing.T) {
    33  			if err := exec(test.args); err != nil {
    34  				t.Errorf("Expected no error, got %s", err)
    35  			}
    36  		})
    37  	}
    38  }