88 "strings"
99 "testing"
1010
11+ "github.com/fabianoflorentino/aprendago/pkg/logger"
1112 "github.com/fabianoflorentino/aprendago/pkg/output"
1213 "github.com/fabianoflorentino/aprendago/pkg/trim"
1314)
@@ -24,7 +25,10 @@ const (
2425// to an expected string. If the resulting string does not match the expected string, the test fails.
2526func TestResolucaoNaPraticaExercicio1 (t * testing.T ) {
2627 output := output .New ()
27- result := output .Capture (ResolucaoNaPraticaExercicio1 )
28+ result , err := output .Capture (ResolucaoNaPraticaExercicio1 )
29+ if err != nil {
30+ logger .Log ("Failed to capture output: %v" , err )
31+ }
2832
2933 expect := `
3034Resolução:
@@ -46,7 +50,10 @@ Resolução:
4650// leading and trailing whitespace, and reports an error if it does not match.
4751func TestResolucaoNaPraticaExercicio2 (t * testing.T ) {
4852 output := output .New ()
49- result := output .Capture (ResolucaoNaPraticaExercicio2 )
53+ result , err := output .Capture (ResolucaoNaPraticaExercicio2 )
54+ if err != nil {
55+ logger .Log ("Failed to capture output: %v" , err )
56+ }
5057
5158 expect := `
5259Resolução:
@@ -69,7 +76,10 @@ Tipo: []string
6976// contain the expected result, the test fails with an error message.
7077func TestResolucaoNaPraticaExercicio3 (t * testing.T ) {
7178 output := output .New ()
72- result := output .Capture (ResolucaoNaPraticaExercicio3 )
79+ result , err := output .Capture (ResolucaoNaPraticaExercicio3 )
80+ if err != nil {
81+ logger .Log ("Failed to capture output: %v" , err )
82+ }
7383
7484 expect := `
7585Resolução:
@@ -92,7 +102,10 @@ Tipo: []string
92102// the test will fail and report the discrepancy.
93103func TestResolucaoNaPraticaExercicio4 (t * testing.T ) {
94104 output := output .New ()
95- result := output .Capture (ResolucaoNaPraticaExercicio4 )
105+ result , err := output .Capture (ResolucaoNaPraticaExercicio4 )
106+ if err != nil {
107+ logger .Log ("Failed to capture output: %v" , err )
108+ }
96109
97110 expect := `
98111Resolução:
@@ -115,7 +128,10 @@ appendSliceY: [42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60]
115128// and an error message is displayed.
116129func TestResolucaoNaPraticaExercicio5 (t * testing.T ) {
117130 output := output .New ()
118- result := output .Capture (ResolucaoNaPraticaExercicio5 )
131+ result , err := output .Capture (ResolucaoNaPraticaExercicio5 )
132+ if err != nil {
133+ logger .Log ("Failed to capture output: %v" , err )
134+ }
119135
120136 expect := `
121137Resolução:
@@ -133,7 +149,10 @@ Resolução:
133149// If the captured output does not match the expected result, the test fails with an error message.
134150func TestResolucaoNaPraticaExercicio6 (t * testing.T ) {
135151 output := output .New ()
136- result := output .Capture (ResolucaoNaPraticaExercicio6 )
152+ result , err := output .Capture (ResolucaoNaPraticaExercicio6 )
153+ if err != nil {
154+ logger .Log ("Failed to capture output: %v" , err )
155+ }
137156
138157 expect := `
139158Resolução:
@@ -154,7 +173,10 @@ Estados: Acre, Alagoas, Amapá, Amazonas, Bahia, Ceará, Espírito Santo, Goiás
154173// surnames, and favorite hobbies.
155174func TestResolucaoNaPraticaExercicio7 (t * testing.T ) {
156175 output := output .New ()
157- result := output .Capture (ResolucaoNaPraticaExercicio7 )
176+ result , err := output .Capture (ResolucaoNaPraticaExercicio7 )
177+ if err != nil {
178+ logger .Log ("Failed to capture output: %v" , err )
179+ }
158180
159181 expect := `
160182Resolução:
@@ -176,7 +198,10 @@ Nome: Ciclano, Sobrenome: da Silva, Hobby favorito: Assistir filmes
176198// If the output does not match the expected result, the test will fail and report an error.
177199func TestResolucaoNaPraticaExercicio8 (t * testing.T ) {
178200 output := output .New ()
179- result := output .Capture (ResolucaoNaPraticaExercicio8 )
201+ result , err := output .Capture (ResolucaoNaPraticaExercicio8 )
202+ if err != nil {
203+ logger .Log ("Failed to capture output: %v" , err )
204+ }
180205
181206 expect := `
182207Resolução:
@@ -208,7 +233,10 @@ Sobrenome_Nome: da_silva_ciclano
208233// the test will fail and report the discrepancy.
209234func TestResolucaoNaPraticaExercicio9 (t * testing.T ) {
210235 output := output .New ()
211- result := output .Capture (ResolucaoNaPraticaExercicio9 )
236+ result , err := output .Capture (ResolucaoNaPraticaExercicio9 )
237+ if err != nil {
238+ logger .Log ("Failed to capture output: %v" , err )
239+ }
212240
213241 expect := `
214242Resolução:
@@ -242,7 +270,10 @@ Sobrenome_Nome: de_tal_ciclano
242270// If the captured output does not match the expected output, the test fails and an error is reported.
243271func TestResolucaoNaPraticaExercicio10 (t * testing.T ) {
244272 output := output .New ()
245- result := output .Capture (ResolucaoNaPraticaExercicio10 )
273+ result , err := output .Capture (ResolucaoNaPraticaExercicio10 )
274+ if err != nil {
275+ logger .Log ("Failed to capture output: %v" , err )
276+ }
246277
247278 expect := `
248279Resolução:
0 commit comments