File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package main
22
33import (
44 "github.com/urfave/cli/v2"
5+
6+ "github.com/obalunenko/advent-of-code/internal/puzzles"
57)
68
79const (
@@ -48,7 +50,7 @@ func cmdRunFlags() []cli.Flag {
4850 Name : flagSession ,
4951 Aliases : []string {flagShortSession },
5052 Usage : "AOC auth session to get inputs" ,
51- EnvVars : []string {"AOC_SESSION" },
53+ EnvVars : []string {puzzles . AOCSession },
5254 FilePath : "" ,
5355 Required : true ,
5456 Hidden : false ,
Original file line number Diff line number Diff line change @@ -61,4 +61,7 @@ const (
6161 unsolved = "not solved"
6262 undefined = "undefined"
6363 inProgress = "in progress"
64+
65+ // AOCSession env variable name.
66+ AOCSession = "AOC_SESSION"
6467)
Original file line number Diff line number Diff line change @@ -25,15 +25,19 @@ type testcase struct {
2525 wantErr bool
2626}
2727
28+ const (
29+ regressionEnabled = "AOC_REGRESSION_ENABLED"
30+ )
31+
2832// Regression tests for all puzzles. Check that answers still correct.
2933func TestRun (t * testing.T ) {
30- if ! getenv .BoolOrDefault ("AOC_REGRESSION_ENABLED" , false ) {
31- t .Skip ( "Regression test disabled" )
34+ if ! getenv .BoolOrDefault (regressionEnabled , false ) {
35+ t .Skipf ( "%s disabled", regressionEnabled )
3236 }
3337
34- session := getenv .StringOrDefault ("AOC_SESSION" , "" )
38+ session := getenv .StringOrDefault (puzzles . AOCSession , "" )
3539 if session == "" {
36- t .Fatal ( "AOC_SESSION not set" )
40+ t .Fatalf ( "%s not set", puzzles . AOCSession )
3741 }
3842
3943 ctx := command .ContextWithSession (context .Background (), session )
You can’t perform that action at this time.
0 commit comments