File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Go CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ test :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - uses : actions/checkout@v4
15+
16+ - name : Setup Go
17+ uses : actions/setup-go@v5
18+ with :
19+ go-version : 1.21
20+
21+ - name : Install dependencies
22+ run : go mod tidy
23+
24+ - name : Run tests
25+ run : go test ./...
Original file line number Diff line number Diff line change 1+ package config
2+
3+ import (
4+ "flag"
5+ "testing"
6+ )
7+
8+ func TestParseArgsDefault (t * testing.T ) {
9+
10+ args := []string {"cmd" }
11+ oldArgs := flag .CommandLine
12+ flag .CommandLine = flag .NewFlagSet (args [0 ], flag .ExitOnError )
13+ defer func () { flag .CommandLine = oldArgs }()
14+
15+ config := ParseArgs ()
16+
17+ if config .Method != "GET" {
18+ t .Errorf ("Méthode par défaut incorrecte: attendu GET, obtenu %s" , config .Method )
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments