@@ -31,7 +31,6 @@ package test
31
31
32
32
import (
33
33
"arduino.cc/builder"
34
- "arduino.cc/builder/constants"
35
34
"arduino.cc/builder/types"
36
35
"github.com/stretchr/testify/require"
37
36
"sort"
@@ -46,9 +45,9 @@ func TestIncludesFinderWithRegExp(t *testing.T) {
46
45
"#include <SPI.h>\n " +
47
46
"^\n " +
48
47
"compilation terminated."
49
- context [ constants . CTX_SOURCE ] = output
48
+ ctx . Source = output
50
49
51
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
50
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
52
51
err := parser .Run (context , ctx )
53
52
NoError (t , err )
54
53
@@ -63,9 +62,9 @@ func TestIncludesFinderWithRegExpEmptyOutput(t *testing.T) {
63
62
64
63
output := ""
65
64
66
- context [ constants . CTX_SOURCE ] = output
65
+ ctx . Source = output
67
66
68
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
67
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
69
68
err := parser .Run (context , ctx )
70
69
NoError (t , err )
71
70
@@ -84,9 +83,9 @@ func TestIncludesFinderWithRegExpPreviousIncludes(t *testing.T) {
84
83
"^\n " +
85
84
"compilation terminated."
86
85
87
- context [ constants . CTX_SOURCE ] = output
86
+ ctx . Source = output
88
87
89
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
88
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
90
89
err := parser .Run (context , ctx )
91
90
NoError (t , err )
92
91
@@ -105,9 +104,9 @@ func TestIncludesFinderWithRegExpPaddedIncludes(t *testing.T) {
105
104
" # include <Wire.h>\n " +
106
105
" ^\n " +
107
106
"compilation terminated.\n "
108
- context [ constants . CTX_SOURCE ] = output
107
+ ctx . Source = output
109
108
110
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
109
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
111
110
err := parser .Run (context , ctx )
112
111
NoError (t , err )
113
112
@@ -125,9 +124,9 @@ func TestIncludesFinderWithRegExpPaddedIncludes2(t *testing.T) {
125
124
" #\t \t \t include <Wire.h>\n " +
126
125
" ^\n " +
127
126
"compilation terminated.\n "
128
- context [ constants . CTX_SOURCE ] = output
127
+ ctx . Source = output
129
128
130
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
129
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
131
130
err := parser .Run (context , ctx )
132
131
NoError (t , err )
133
132
@@ -144,9 +143,9 @@ func TestIncludesFinderWithRegExpPaddedIncludes3(t *testing.T) {
144
143
output := "/some/path/sketch.ino:1:33: fatal error: SPI.h: No such file or directory\n " +
145
144
"compilation terminated.\n "
146
145
147
- context [ constants . CTX_SOURCE ] = output
146
+ ctx . Source = output
148
147
149
- parser := builder.IncludesFinderWithRegExp {ContextField : constants . CTX_SOURCE }
148
+ parser := builder.IncludesFinderWithRegExp {Source : & ctx . Source }
150
149
err := parser .Run (context , ctx )
151
150
NoError (t , err )
152
151
0 commit comments