A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/arduino/arduino-lint/commit/9ef0caa84a084d97576cb489b620fff231ac3b15 below:

Always discover subprojects · arduino/arduino-lint@9ef0caa · GitHub

16 16

package project

17 17 18 18

import (

19 +

"fmt"

19 20

"os"

20 21

"reflect"

21 22

"testing"

@@ -53,16 +54,16 @@ func TestFindProjects(t *testing.T) {

53 54 54 55

testTables := []struct {

55 56

testName string

56 -

superprojectTypeFilter string

57 -

recursive string

57 +

superprojectTypeFilter []string

58 +

recursive []string

58 59

projectPaths []string

59 60

errorAssertion assert.ErrorAssertionFunc

60 61

expectedProjects []Type

61 62

}{

62 63

{

63 64

"Sketch file",

64 -

"all",

65 -

"",

65 +

[]string{"all", "sketch"},

66 +

[]string{"true", "false"},

66 67

[]string{sketchPath.Join("Sketch.ino").String()},

67 68

assert.NoError,

68 69

[]Type{

@@ -75,8 +76,8 @@ func TestFindProjects(t *testing.T) {

75 76

},

76 77

{

77 78

"Library file",

78 -

"all",

79 -

"",

79 +

[]string{"all", "library"},

80 +

[]string{"true", "false"},

80 81

[]string{libraryPath.Join("Library.h").String()},

81 82

assert.NoError,

82 83

[]Type{

@@ -94,8 +95,8 @@ func TestFindProjects(t *testing.T) {

94 95

},

95 96

{

96 97

"Platform file",

97 -

"all",

98 -

"",

98 +

[]string{"all", "platform"},

99 +

[]string{"true", "false"},

99 100

[]string{platformPath.Join("boards.txt").String()},

100 101

assert.NoError,

101 102

[]Type{

@@ -118,8 +119,8 @@ func TestFindProjects(t *testing.T) {

118 119

},

119 120

{

120 121

"Package index file",

121 -

"all",

122 -

"",

122 +

[]string{"all", "package-index"},

123 +

[]string{"true", "false"},

123 124

[]string{packageIndexFilePath.String()},

124 125

assert.NoError,

125 126

[]Type{

@@ -132,8 +133,8 @@ func TestFindProjects(t *testing.T) {

132 133

},

133 134

{

134 135

"Explicit file",

135 -

"sketch",

136 -

"",

136 +

[]string{"sketch"},

137 +

[]string{"true", "false"},

137 138

[]string{libraryPath.Join("Library.h").String()},

138 139

assert.NoError,

139 140

[]Type{

@@ -146,8 +147,8 @@ func TestFindProjects(t *testing.T) {

146 147

},

147 148

{

148 149

"Sketch folder",

149 -

"all",

150 -

"",

150 +

[]string{"all", "sketch"},

151 +

[]string{"true", "false"},

151 152

[]string{sketchPath.String()},

152 153

assert.NoError,

153 154

[]Type{

@@ -160,8 +161,8 @@ func TestFindProjects(t *testing.T) {

160 161

},

161 162

{

162 163

"Library folder",

163 -

"all",

164 -

"",

164 +

[]string{"all", "library"},

165 +

[]string{"true", "false"},

165 166

[]string{libraryPath.String()},

166 167

assert.NoError,

167 168

[]Type{

@@ -179,8 +180,8 @@ func TestFindProjects(t *testing.T) {

179 180

},

180 181

{

181 182

"Platform folder",

182 -

"all",

183 -

"",

183 +

[]string{"all", "platform"},

184 +

[]string{"true", "false"},

184 185

[]string{platformPath.String()},

185 186

assert.NoError,

186 187

[]Type{

@@ -203,8 +204,8 @@ func TestFindProjects(t *testing.T) {

203 204

},

204 205

{

205 206

"Package index folder",

206 -

"all",

207 -

"",

207 +

[]string{"all", "package-index"},

208 +

[]string{"true", "false"},

208 209

[]string{packageIndexFolderPath.String()},

209 210

assert.NoError,

210 211

[]Type{

@@ -217,8 +218,8 @@ func TestFindProjects(t *testing.T) {

217 218

},

218 219

{

219 220

"Explicit folder",

220 -

"sketch",

221 -

"false",

221 +

[]string{"sketch"},

222 +

[]string{"false"},

222 223

[]string{libraryPath.String()},

223 224

assert.NoError,

224 225

[]Type{

@@ -230,9 +231,23 @@ func TestFindProjects(t *testing.T) {

230 231

},

231 232

},

232 233

{

233 -

"Projects folder, recursive",

234 -

"all",

235 -

"true",

234 +

"Explicit folder",

235 +

[]string{"sketch"},

236 +

[]string{"true"},

237 +

[]string{libraryPath.String()},

238 +

assert.NoError,

239 +

[]Type{

240 +

{

241 +

Path: libraryExamplePath,

242 +

ProjectType: projecttype.Sketch,

243 +

SuperprojectType: projecttype.Sketch,

244 +

},

245 +

},

246 +

},

247 +

{

248 +

"Projects folder",

249 +

[]string{"all"},

250 +

[]string{"true"},

236 251

[]string{projectsPath.String()},

237 252

assert.NoError,

238 253

[]Type{

@@ -253,18 +268,37 @@ func TestFindProjects(t *testing.T) {

253 268

},

254 269

},

255 270

},

271 +

{

272 +

"Projects folder",

273 +

[]string{"sketch"},

274 +

[]string{"true"},

275 +

[]string{projectsPath.String()},

276 +

assert.NoError,

277 +

[]Type{

278 +

{

279 +

Path: projectsPathLibraryExample,

280 +

ProjectType: projecttype.Sketch,

281 +

SuperprojectType: projecttype.Sketch,

282 +

},

283 +

{

284 +

Path: projectsPathSketch,

285 +

ProjectType: projecttype.Sketch,

286 +

SuperprojectType: projecttype.Sketch,

287 +

},

288 +

},

289 +

},

256 290

{

257 291

"Projects folder, non-recursive",

258 -

"all",

259 -

"false",

292 +

[]string{"all"},

293 +

[]string{"false"},

260 294

[]string{projectsPath.String()},

261 295

assert.Error,

262 296

[]Type{},

263 297

},

264 298

{

265 299

"Multiple target folders",

266 -

"all",

267 -

"true",

300 +

[]string{"all"},

301 +

[]string{"true"},

268 302

[]string{projectsPath.String(), sketchPath.String()},

269 303

assert.NoError,

270 304

[]Type{

@@ -290,38 +324,32 @@ func TestFindProjects(t *testing.T) {

290 324

},

291 325

},

292 326

},

293 -

{

294 -

"superproject type filter",

295 -

"sketch",

296 -

"true",

297 -

[]string{projectsPath.String()},

298 -

assert.NoError,

299 -

[]Type{

300 -

{

301 -

Path: projectsPathLibraryExample,

302 -

ProjectType: projecttype.Sketch,

303 -

SuperprojectType: projecttype.Sketch,

304 -

},

305 -

{

306 -

Path: projectsPathSketch,

307 -

ProjectType: projecttype.Sketch,

308 -

SuperprojectType: projecttype.Sketch,

309 -

},

310 -

},

311 -

},

312 327

}

313 328 314 329

for _, testTable := range testTables {

315 -

flags := test.ConfigurationFlags()

316 -

flags.Set("project-type", testTable.superprojectTypeFilter)

317 -

if testTable.recursive != "" {

318 -

flags.Set("recursive", testTable.recursive)

319 -

}

320 -

configuration.Initialize(flags, testTable.projectPaths)

321 -

foundProjects, err := FindProjects()

322 -

testTable.errorAssertion(t, err)

323 -

if err == nil {

324 -

assert.True(t, reflect.DeepEqual(foundProjects, testTable.expectedProjects), testTable.testName)

330 +

for _, superprojectTypeFilter := range testTable.superprojectTypeFilter {

331 +

for _, recursive := range testTable.recursive {

332 +

flags := test.ConfigurationFlags()

333 +

flags.Set("project-type", superprojectTypeFilter)

334 +

if recursive != "" {

335 +

flags.Set("recursive", recursive)

336 +

}

337 +

configuration.Initialize(flags, testTable.projectPaths)

338 +

foundProjects, err := FindProjects()

339 +

testTable.errorAssertion(t, err)

340 +

if err == nil {

341 +

assert.True(

342 +

t,

343 +

reflect.DeepEqual(foundProjects, testTable.expectedProjects),

344 +

fmt.Sprintf(

345 +

"%s (%s project-type=%s recursive=%s)",

346 +

testTable.testName,

347 +

testTable.projectPaths,

348 +

superprojectTypeFilter, recursive,

349 +

),

350 +

)

351 +

}

352 +

}

325 353

}

326 354

}

327 355

}


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4