File: main_test.go

package info (click to toggle)
golang-github-nicksnyder-go-i18n.v2 2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 464 kB
  • sloc: xml: 198; sh: 5; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (5)
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
28
29
30
31
32
33
package main

import (
	"strings"
	"testing"
)

func TestMain(t *testing.T) {
	testCases := []struct {
		args     []string
		exitCode int
	}{
		{
			args:     []string{"-help"},
			exitCode: 2,
		},
		{
			args:     []string{"extract"},
			exitCode: 0,
		},
		{
			args:     []string{"merge"},
			exitCode: 1,
		},
	}
	for _, testCase := range testCases {
		t.Run(strings.Join(testCase.args, " "), func(t *testing.T) {
			if code := testableMain(testCase.args); code != testCase.exitCode {
				t.Fatalf("expected exit code %d; got %d", testCase.exitCode, code)
			}
		})
	}
}