1717// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1818// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1919
20+ // Copyright (c) 2025 Valentin Lobstein (Chocapikk) <balgogan@protonmail.com>
21+ //
22+ // Permission is hereby granted, free of charge, to any person obtaining a copy of
23+ // this software and associated documentation files (the "Software"), to deal in
24+ // the Software without restriction, including without limitation the rights to
25+ // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
26+ // the Software, and to permit persons to whom the Software is furnished to do so,
27+ // subject to the following conditions:
28+ //
29+ // The above copyright notice and this permission notice shall be included in all
30+ // copies or substantial portions of the Software.
31+ //
32+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
34+ // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
35+ // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
36+ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
37+ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38+
2039package utils
2140
2241import (
@@ -45,7 +64,7 @@ func TestLogger_Info(t *testing.T) {
4564 var buf bytes.Buffer
4665 originalLogger := DefaultLogger .Logger
4766 DefaultLogger .Logger = log .New (& buf , "" , 0 )
48- defer func () { DefaultLogger .Logger = originalLogger }() // Restaure l'ancien Logger
67+ defer func () { DefaultLogger .Logger = originalLogger }()
4968
5069 msg := "This is an info message"
5170 DefaultLogger .Info (msg )
@@ -105,14 +124,13 @@ func TestLogger_PrintBanner(t *testing.T) {
105124 version := "v1.0.0"
106125 isLatest := true
107126 DefaultLogger .PrintBanner (version , isLatest )
108- defer func () { _ = w .Close () } ()
127+ _ = w .Close ()
109128
110129 var outBuf bytes.Buffer
111130 _ , _ = outBuf .ReadFrom (r )
112131 os .Stdout = originalStdout
113132
114133 output := outBuf .String ()
115-
116134 if ! strings .Contains (output , version ) || ! strings .Contains (output , "latest" ) {
117135 t .Errorf ("PrintBanner() output = %v, want version %v and 'latest'" , output , version )
118136 }
@@ -121,14 +139,13 @@ func TestLogger_PrintBanner(t *testing.T) {
121139 os .Stdout = w
122140
123141 DefaultLogger .PrintBanner (version , false )
142+ _ = w .Close ()
124143
125- defer func () { _ = w .Close () }()
126144 outBuf .Reset ()
127145 _ , _ = outBuf .ReadFrom (r )
128146 os .Stdout = originalStdout
129147
130148 output = outBuf .String ()
131-
132149 if ! strings .Contains (output , "outdated" ) {
133150 t .Errorf ("PrintBanner() output = %v, want 'outdated'" , output )
134151 }
0 commit comments