(t *testing.T)
| 138 | } |
| 139 | |
| 140 | func TestFileGetter_GetFile(t *testing.T) { |
| 141 | g := new(FileGetter) |
| 142 | dst := testing_helper.TempTestFile(t) |
| 143 | defer os.RemoveAll(filepath.Dir(dst)) |
| 144 | ctx := context.Background() |
| 145 | |
| 146 | req := &Request{ |
| 147 | Dst: dst, |
| 148 | u: testModuleURL("basic-file/foo.txt"), |
| 149 | } |
| 150 | |
| 151 | // With a dir that doesn't exist |
| 152 | if err := g.GetFile(ctx, req); err != nil { |
| 153 | t.Fatalf("err: %s", err) |
| 154 | } |
| 155 | |
| 156 | // Verify the destination folder is a symlink |
| 157 | fi, err := os.Lstat(dst) |
| 158 | if err != nil { |
| 159 | t.Fatalf("err: %s", err) |
| 160 | } |
| 161 | if fi.Mode()&os.ModeSymlink == 0 { |
| 162 | t.Fatal("destination is not a symlink") |
| 163 | } |
| 164 | |
| 165 | // Verify the main file exists |
| 166 | testing_helper.AssertContents(t, dst, "Hello\n") |
| 167 | } |
| 168 | |
| 169 | func TestFileGetter_GetFile_Copy(t *testing.T) { |
| 170 | g := new(FileGetter) |
nothing calls this directly
no test coverage detected