|
30 | 30 | package test |
31 | 31 |
|
32 | 32 | import ( |
| 33 | + "os" |
| 34 | + "path/filepath" |
| 35 | + "testing" |
| 36 | + |
33 | 37 | "arduino.cc/builder" |
34 | 38 | "arduino.cc/builder/gohasissues" |
35 | 39 | "arduino.cc/builder/types" |
36 | 40 | "arduino.cc/builder/utils" |
37 | 41 | "github.com/stretchr/testify/require" |
38 | | - "os" |
39 | | - "path/filepath" |
40 | | - "testing" |
41 | 42 | ) |
42 | 43 |
|
43 | 44 | func TestWipeoutBuildPathIfBuildOptionsChanged(t *testing.T) { |
@@ -100,34 +101,3 @@ func TestWipeoutBuildPathIfBuildOptionsChangedNoPreviousBuildOptions(t *testing. |
100 | 101 | _, err = os.Stat(filepath.Join(buildPath, "should_not_be_deleted.txt")) |
101 | 102 | NoError(t, err) |
102 | 103 | } |
103 | | - |
104 | | -func TestWipeoutBuildPathIfBuildOptionsChangedBuildOptionsMatch(t *testing.T) { |
105 | | - ctx := &types.Context{} |
106 | | - |
107 | | - buildPath := SetupBuildPath(t, ctx) |
108 | | - defer os.RemoveAll(buildPath) |
109 | | - |
110 | | - ctx.BuildOptionsJsonPrevious = "{ \"old\":\"old\" }" |
111 | | - ctx.BuildOptionsJson = "{ \"old\":\"old\" }" |
112 | | - |
113 | | - utils.TouchFile(filepath.Join(buildPath, "should_not_be_deleted.txt")) |
114 | | - |
115 | | - commands := []types.Command{ |
116 | | - &builder.WipeoutBuildPathIfBuildOptionsChanged{}, |
117 | | - } |
118 | | - |
119 | | - for _, command := range commands { |
120 | | - err := command.Run(ctx) |
121 | | - NoError(t, err) |
122 | | - } |
123 | | - |
124 | | - _, err := os.Stat(buildPath) |
125 | | - NoError(t, err) |
126 | | - |
127 | | - files, err := gohasissues.ReadDir(buildPath) |
128 | | - NoError(t, err) |
129 | | - require.Equal(t, 1, len(files)) |
130 | | - |
131 | | - _, err = os.Stat(filepath.Join(buildPath, "should_not_be_deleted.txt")) |
132 | | - NoError(t, err) |
133 | | -} |
0 commit comments