|
14 | 14 | package hugo |
15 | 15 |
|
16 | 16 | import ( |
17 | | - "bytes" |
18 | 17 | "context" |
19 | 18 | "testing" |
20 | 19 |
|
21 | 20 | "github.com/bep/logg" |
22 | 21 | qt "github.com/frankban/quicktest" |
23 | | - "github.com/gohugoio/hugo/common/loggers" |
24 | 22 | ) |
25 | 23 |
|
26 | 24 | func TestDeprecationLogLevelFromVersion(t *testing.T) { |
@@ -61,38 +59,3 @@ func TestGetBuildInfo(t *testing.T) { |
61 | 59 | c.Assert(bi.GoVersion, qt.Not(qt.Equals), "") |
62 | 60 | } |
63 | 61 | } |
64 | | - |
65 | | -func TestWarnDeprecatedEdition(t *testing.T) { |
66 | | - c := qt.New(t) |
67 | | - |
68 | | - origExtended, origWithdeploy := IsExtended, IsWithdeploy |
69 | | - t.Cleanup(func() { |
70 | | - IsExtended = origExtended |
71 | | - IsWithdeploy = origWithdeploy |
72 | | - loggers.SetGlobalLogger(nil) |
73 | | - }) |
74 | | - |
75 | | - var buf bytes.Buffer |
76 | | - loggers.SetGlobalLogger(loggers.New(loggers.Options{Level: logg.LevelInfo, StdErr: &buf})) |
77 | | - |
78 | | - IsExtended = true |
79 | | - IsWithdeploy = false |
80 | | - WarnDeprecatedEdition() |
81 | | - c.Assert(buf.String(), qt.Contains, "the extended edition of the Hugo executable") |
82 | | - c.Assert(buf.String(), qt.Contains, "Use the standard edition instead") |
83 | | - |
84 | | - buf.Reset() |
85 | | - |
86 | | - IsExtended = true |
87 | | - IsWithdeploy = true |
88 | | - WarnDeprecatedEdition() |
89 | | - c.Assert(buf.String(), qt.Contains, "the extended_withdeploy edition of the Hugo executable") |
90 | | - c.Assert(buf.String(), qt.Contains, "Use the withdeploy edition instead") |
91 | | - |
92 | | - buf.Reset() |
93 | | - |
94 | | - IsExtended = false |
95 | | - IsWithdeploy = false |
96 | | - WarnDeprecatedEdition() |
97 | | - c.Assert(buf.String(), qt.Equals, "") |
98 | | -} |
0 commit comments