1+ // Copyright 2022 The Gitea Authors. All rights reserved.
2+ // SPDX-License-Identifier: MIT
3+
14package jobparser
25
36import (
4- "fmt"
57 "strings"
68 "testing"
79
810 "github.com/nektos/act/pkg/model"
9-
1011 "github.com/stretchr/testify/assert"
1112)
1213
@@ -277,66 +278,66 @@ func TestParseMappingNode(t *testing.T) {
277278 tests := []struct {
278279 input string
279280 scalars []string
280- datas []interface {}
281+ datas []any
281282 }{
282283 {
283284 input : "on:\n push:\n branches:\n - master" ,
284285 scalars : []string {"push" },
285- datas : []interface {} {
286- map [string ]interface {} {
287- "branches" : []interface {} {"master" },
286+ datas : []any {
287+ map [string ]any {
288+ "branches" : []any {"master" },
288289 },
289290 },
290291 },
291292 {
292293 input : "on:\n branch_protection_rule:\n types: [created, deleted]" ,
293294 scalars : []string {"branch_protection_rule" },
294- datas : []interface {} {
295- map [string ]interface {} {
296- "types" : []interface {} {"created" , "deleted" },
295+ datas : []any {
296+ map [string ]any {
297+ "types" : []any {"created" , "deleted" },
297298 },
298299 },
299300 },
300301 {
301302 input : "on:\n project:\n types: [created, deleted]\n milestone:\n types: [opened, deleted]" ,
302303 scalars : []string {"project" , "milestone" },
303- datas : []interface {} {
304- map [string ]interface {} {
305- "types" : []interface {} {"created" , "deleted" },
304+ datas : []any {
305+ map [string ]any {
306+ "types" : []any {"created" , "deleted" },
306307 },
307- map [string ]interface {} {
308- "types" : []interface {} {"opened" , "deleted" },
308+ map [string ]any {
309+ "types" : []any {"opened" , "deleted" },
309310 },
310311 },
311312 },
312313 {
313314 input : "on:\n pull_request:\n types:\n - opened\n branches:\n - 'releases/**'" ,
314315 scalars : []string {"pull_request" },
315- datas : []interface {} {
316- map [string ]interface {} {
317- "types" : []interface {} {"opened" },
318- "branches" : []interface {} {"releases/**" },
316+ datas : []any {
317+ map [string ]any {
318+ "types" : []any {"opened" },
319+ "branches" : []any {"releases/**" },
319320 },
320321 },
321322 },
322323 {
323324 input : "on:\n push:\n branches:\n - main\n pull_request:\n types:\n - opened\n branches:\n - '**'" ,
324325 scalars : []string {"push" , "pull_request" },
325- datas : []interface {} {
326- map [string ]interface {} {
327- "branches" : []interface {} {"main" },
326+ datas : []any {
327+ map [string ]any {
328+ "branches" : []any {"main" },
328329 },
329- map [string ]interface {} {
330- "types" : []interface {} {"opened" },
331- "branches" : []interface {} {"**" },
330+ map [string ]any {
331+ "types" : []any {"opened" },
332+ "branches" : []any {"**" },
332333 },
333334 },
334335 },
335336 {
336337 input : "on:\n schedule:\n - cron: '20 6 * * *'" ,
337338 scalars : []string {"schedule" },
338- datas : []interface {} {
339- []interface {}{ map [string ]interface {} {
339+ datas : []any {
340+ []any { map [string ]any {
340341 "cron" : "20 6 * * *" ,
341342 }},
342343 },
@@ -348,10 +349,10 @@ func TestParseMappingNode(t *testing.T) {
348349 workflow , err := model .ReadWorkflow (strings .NewReader (test .input ))
349350 assert .NoError (t , err )
350351
351- scalars , datas , err := parseMappingNode [interface {} ](& workflow .RawOn )
352+ scalars , datas , err := parseMappingNode [any ](& workflow .RawOn )
352353 assert .NoError (t , err )
353- assert .EqualValues (t , test .scalars , scalars , fmt . Sprintf ( "%#v" , scalars ) )
354- assert .EqualValues (t , test .datas , datas , fmt . Sprintf ( "%#v" , datas ) )
354+ assert .EqualValues (t , test .scalars , scalars , "%#v" , scalars )
355+ assert .EqualValues (t , test .datas , datas , "%#v" , datas )
355356 })
356357 }
357358}
0 commit comments