File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ package internal
2
+
3
+ import (
4
+ "os"
5
+ "path/filepath"
6
+ "testing"
7
+
8
+ "github.com/stretchr/testify/assert"
9
+ "github.com/stretchr/testify/require"
10
+ )
11
+
12
+ func Test_generateImports (t * testing.T ) {
13
+ cfg := & Configuration {
14
+ Version : "v1.57.0" ,
15
+ Plugins : []* Plugin {
16
+ {
17
+ Module : "example.org/foo/bar" ,
18
+ Import : "example.org/foo/bar/test" ,
19
+ Version : "v1.2.3" ,
20
+ },
21
+ {
22
+ Module : "example.com/foo/bar" ,
23
+ Import : "example.com/foo/bar/test" ,
24
+ Path : "/my/path" ,
25
+ },
26
+ },
27
+ }
28
+
29
+ data , err := generateImports (cfg )
30
+ require .NoError (t , err )
31
+
32
+ expected , err := os .ReadFile (filepath .Join ("testdata" , "imports.go" ))
33
+ require .NoError (t , err )
34
+
35
+ assert .Equal (t , expected , data )
36
+ }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ _ "example.com/foo/bar/test"
5
+ _ "example.org/foo/bar/test"
6
+ )
You can’t perform that action at this time.
0 commit comments