Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33f59b5

Browse files
Add corrupted json test
1 parent650622b commit33f59b5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎tools/download_test.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,23 @@ func TestDownload(t *testing.T) {
160160
})
161161
}
162162
}
163+
164+
funcTestCorruptedInstalled(t*testing.T) {
165+
// prepare the test environment
166+
tempDir:=t.TempDir()
167+
tempDirPath:=paths.New(tempDir)
168+
testIndex:= index.Resource{
169+
IndexFile:*paths.New("testdata","test_tool_index.json"),
170+
LastRefresh:time.Now(),
171+
}
172+
corruptedJSON:=tempDirPath.Join("installed.json")
173+
fileJSON,err:=corruptedJSON.Create()
174+
require.NoError(t,err)
175+
deferfileJSON.Close()
176+
_,err=fileJSON.Write([]byte("Hello"))
177+
require.NoError(t,err)
178+
testTools:=New(tempDirPath,&testIndex,func(msgstring) {t.Log(msg) })
179+
// Download the tool
180+
err=testTools.Download("arduino-test","avrdude","6.3.0-arduino17","keep")
181+
require.NoError(t,err)
182+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp