github.com/bhameyie/otto@v0.2.1-0.20160406174117-16052efa52ec/helper/bindata/bindata_test.go (about) 1 // Code generated by go-bindata. 2 // sources: 3 // test-data/copy-dir-basic/a.txt 4 // test-data/copy-dir-basic/b.txt 5 // test-data/copy-dir-basic/dir/c.txt 6 // test-data/copy-dir-basic/t.tpl 7 // test-data/copy-dir-basic-expected/a.txt 8 // test-data/copy-dir-basic-expected/b.txt 9 // test-data/copy-dir-basic-expected/dir/c.txt 10 // test-data/copy-dir-basic-expected/t 11 // test-data/copy-dir-extends/a.tpl 12 // test-data/copy-dir-extends/base 13 // test-data/copy-dir-extends/base.tpl 14 // test-data/copy-dir-extends-expected/a 15 // test-data/copy-dir-extends-expected/base 16 // test-data/copy-dir-extends-var/a.tpl 17 // test-data/copy-dir-extends-var/base.tpl 18 // test-data/copy-dir-extends-var-expected/a 19 // test-data/copy-dir-extends-var-expected/base 20 // test-data/copy-dir-include/a.tpl 21 // test-data/copy-dir-include/b 22 // test-data/copy-dir-include-expected/a 23 // test-data/copy-dir-include-expected/b 24 // test-data/copy-dir-shared/a.tpl 25 // test-data/copy-dir-shared-expected/a 26 // DO NOT EDIT! 27 28 package bindata 29 30 import ( 31 "bytes" 32 "compress/gzip" 33 "fmt" 34 "io" 35 "io/ioutil" 36 "os" 37 "path/filepath" 38 "strings" 39 "time" 40 ) 41 42 func bindataRead(data, name string) ([]byte, error) { 43 gz, err := gzip.NewReader(strings.NewReader(data)) 44 if err != nil { 45 return nil, fmt.Errorf("Read %q: %v", name, err) 46 } 47 48 var buf bytes.Buffer 49 _, err = io.Copy(&buf, gz) 50 clErr := gz.Close() 51 52 if err != nil { 53 return nil, fmt.Errorf("Read %q: %v", name, err) 54 } 55 if clErr != nil { 56 return nil, err 57 } 58 59 return buf.Bytes(), nil 60 } 61 62 type asset struct { 63 bytes []byte 64 info os.FileInfo 65 } 66 67 type bindataFileInfo struct { 68 name string 69 size int64 70 mode os.FileMode 71 modTime time.Time 72 } 73 74 func (fi bindataFileInfo) Name() string { 75 return fi.name 76 } 77 func (fi bindataFileInfo) Size() int64 { 78 return fi.size 79 } 80 func (fi bindataFileInfo) Mode() os.FileMode { 81 return fi.mode 82 } 83 func (fi bindataFileInfo) ModTime() time.Time { 84 return fi.modTime 85 } 86 func (fi bindataFileInfo) IsDir() bool { 87 return false 88 } 89 func (fi bindataFileInfo) Sys() interface{} { 90 return nil 91 } 92 93 var _testDataCopyDirBasicATxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe4\x02\x04\x00\x00\xff\xff\xa5\x85\x6e\x48\x02\x00\x00\x00" 94 95 func testDataCopyDirBasicATxtBytes() ([]byte, error) { 96 return bindataRead( 97 _testDataCopyDirBasicATxt, 98 "test-data/copy-dir-basic/a.txt", 99 ) 100 } 101 102 func testDataCopyDirBasicATxt() (*asset, error) { 103 bytes, err := testDataCopyDirBasicATxtBytes() 104 if err != nil { 105 return nil, err 106 } 107 108 info := bindataFileInfo{name: "test-data/copy-dir-basic/a.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 109 a := &asset{bytes: bytes, info: info} 110 return a, nil 111 } 112 113 var _testDataCopyDirBasicBTxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe2\x02\x04\x00\x00\xff\xff\x66\xd6\x43\x63\x02\x00\x00\x00" 114 115 func testDataCopyDirBasicBTxtBytes() ([]byte, error) { 116 return bindataRead( 117 _testDataCopyDirBasicBTxt, 118 "test-data/copy-dir-basic/b.txt", 119 ) 120 } 121 122 func testDataCopyDirBasicBTxt() (*asset, error) { 123 bytes, err := testDataCopyDirBasicBTxtBytes() 124 if err != nil { 125 return nil, err 126 } 127 128 info := bindataFileInfo{name: "test-data/copy-dir-basic/b.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 129 a := &asset{bytes: bytes, info: info} 130 return a, nil 131 } 132 133 var _testDataCopyDirBasicDirCTxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe6\x02\x04\x00\x00\xff\xff\x27\xe7\x58\x7a\x02\x00\x00\x00" 134 135 func testDataCopyDirBasicDirCTxtBytes() ([]byte, error) { 136 return bindataRead( 137 _testDataCopyDirBasicDirCTxt, 138 "test-data/copy-dir-basic/dir/c.txt", 139 ) 140 } 141 142 func testDataCopyDirBasicDirCTxt() (*asset, error) { 143 bytes, err := testDataCopyDirBasicDirCTxtBytes() 144 if err != nil { 145 return nil, err 146 } 147 148 info := bindataFileInfo{name: "test-data/copy-dir-basic/dir/c.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 149 a := &asset{bytes: bytes, info: info} 150 return a, nil 151 } 152 153 var _testDataCopyDirBasicTTpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\x2e\x2d\x2a\x4a\xcd\x2b\x51\x88\x4c\x4d\x2c\xb2\x52\xa8\xae\x56\x28\x4b\xcc\x29\x4d\x55\xa8\xad\xe5\x02\x04\x00\x00\xff\xff\xc8\x33\xc7\x9f\x1a\x00\x00\x00" 154 155 func testDataCopyDirBasicTTplBytes() ([]byte, error) { 156 return bindataRead( 157 _testDataCopyDirBasicTTpl, 158 "test-data/copy-dir-basic/t.tpl", 159 ) 160 } 161 162 func testDataCopyDirBasicTTpl() (*asset, error) { 163 bytes, err := testDataCopyDirBasicTTplBytes() 164 if err != nil { 165 return nil, err 166 } 167 168 info := bindataFileInfo{name: "test-data/copy-dir-basic/t.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 169 a := &asset{bytes: bytes, info: info} 170 return a, nil 171 } 172 173 var _testDataCopyDirBasicExpectedATxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe4\x02\x04\x00\x00\xff\xff\xa5\x85\x6e\x48\x02\x00\x00\x00" 174 175 func testDataCopyDirBasicExpectedATxtBytes() ([]byte, error) { 176 return bindataRead( 177 _testDataCopyDirBasicExpectedATxt, 178 "test-data/copy-dir-basic-expected/a.txt", 179 ) 180 } 181 182 func testDataCopyDirBasicExpectedATxt() (*asset, error) { 183 bytes, err := testDataCopyDirBasicExpectedATxtBytes() 184 if err != nil { 185 return nil, err 186 } 187 188 info := bindataFileInfo{name: "test-data/copy-dir-basic-expected/a.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 189 a := &asset{bytes: bytes, info: info} 190 return a, nil 191 } 192 193 var _testDataCopyDirBasicExpectedBTxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe2\x02\x04\x00\x00\xff\xff\x66\xd6\x43\x63\x02\x00\x00\x00" 194 195 func testDataCopyDirBasicExpectedBTxtBytes() ([]byte, error) { 196 return bindataRead( 197 _testDataCopyDirBasicExpectedBTxt, 198 "test-data/copy-dir-basic-expected/b.txt", 199 ) 200 } 201 202 func testDataCopyDirBasicExpectedBTxt() (*asset, error) { 203 bytes, err := testDataCopyDirBasicExpectedBTxtBytes() 204 if err != nil { 205 return nil, err 206 } 207 208 info := bindataFileInfo{name: "test-data/copy-dir-basic-expected/b.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 209 a := &asset{bytes: bytes, info: info} 210 return a, nil 211 } 212 213 var _testDataCopyDirBasicExpectedDirCTxt = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\xe6\x02\x04\x00\x00\xff\xff\x27\xe7\x58\x7a\x02\x00\x00\x00" 214 215 func testDataCopyDirBasicExpectedDirCTxtBytes() ([]byte, error) { 216 return bindataRead( 217 _testDataCopyDirBasicExpectedDirCTxt, 218 "test-data/copy-dir-basic-expected/dir/c.txt", 219 ) 220 } 221 222 func testDataCopyDirBasicExpectedDirCTxt() (*asset, error) { 223 bytes, err := testDataCopyDirBasicExpectedDirCTxtBytes() 224 if err != nil { 225 return nil, err 226 } 227 228 info := bindataFileInfo{name: "test-data/copy-dir-basic-expected/dir/c.txt", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 229 a := &asset{bytes: bytes, info: info} 230 return a, nil 231 } 232 233 var _testDataCopyDirBasicExpectedT = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x72\x2e\x2d\x2a\x4a\xcd\x2b\x51\x88\x4c\x4d\x2c\xb2\x52\x48\xcb\xcf\xe7\x02\x04\x00\x00\xff\xff\x34\x06\xb8\x03\x12\x00\x00\x00" 234 235 func testDataCopyDirBasicExpectedTBytes() ([]byte, error) { 236 return bindataRead( 237 _testDataCopyDirBasicExpectedT, 238 "test-data/copy-dir-basic-expected/t", 239 ) 240 } 241 242 func testDataCopyDirBasicExpectedT() (*asset, error) { 243 bytes, err := testDataCopyDirBasicExpectedTBytes() 244 if err != nil { 245 return nil, err 246 } 247 248 info := bindataFileInfo{name: "test-data/copy-dir-basic-expected/t", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 249 a := &asset{bytes: bytes, info: info} 250 return a, nil 251 } 252 253 var _testDataCopyDirExtendsATpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xaa\x56\x55\x48\xad\x28\x49\xcd\x4b\x29\x56\x50\x4a\x4a\x2c\x4e\xd5\x2b\x29\xc8\x51\x52\x50\xad\xe5\x02\x04\x00\x00\xff\xff\x23\xb9\xd9\xe8\x19\x00\x00\x00" 254 255 func testDataCopyDirExtendsATplBytes() ([]byte, error) { 256 return bindataRead( 257 _testDataCopyDirExtendsATpl, 258 "test-data/copy-dir-extends/a.tpl", 259 ) 260 } 261 262 func testDataCopyDirExtendsATpl() (*asset, error) { 263 bytes, err := testDataCopyDirExtendsATplBytes() 264 if err != nil { 265 return nil, err 266 } 267 268 info := bindataFileInfo{name: "test-data/copy-dir-extends/a.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 269 a := &asset{bytes: bytes, info: info} 270 return a, nil 271 } 272 273 var _testDataCopyDirExtendsBase = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x70\xf5\xf1\xf1\x57\xe4\x02\x04\x00\x00\xff\xff\x72\x1b\x50\xee\x07\x00\x00\x00" 274 275 func testDataCopyDirExtendsBaseBytes() ([]byte, error) { 276 return bindataRead( 277 _testDataCopyDirExtendsBase, 278 "test-data/copy-dir-extends/base", 279 ) 280 } 281 282 func testDataCopyDirExtendsBase() (*asset, error) { 283 bytes, err := testDataCopyDirExtendsBaseBytes() 284 if err != nil { 285 return nil, err 286 } 287 288 info := bindataFileInfo{name: "test-data/copy-dir-extends/base", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 289 a := &asset{bytes: bytes, info: info} 290 return a, nil 291 } 292 293 var _testDataCopyDirExtendsBaseTpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x70\xf5\xf1\xf1\x57\xe4\x02\x04\x00\x00\xff\xff\x72\x1b\x50\xee\x07\x00\x00\x00" 294 295 func testDataCopyDirExtendsBaseTplBytes() ([]byte, error) { 296 return bindataRead( 297 _testDataCopyDirExtendsBaseTpl, 298 "test-data/copy-dir-extends/base.tpl", 299 ) 300 } 301 302 func testDataCopyDirExtendsBaseTpl() (*asset, error) { 303 bytes, err := testDataCopyDirExtendsBaseTplBytes() 304 if err != nil { 305 return nil, err 306 } 307 308 info := bindataFileInfo{name: "test-data/copy-dir-extends/base.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 309 a := &asset{bytes: bytes, info: info} 310 return a, nil 311 } 312 313 var _testDataCopyDirExtendsExpectedA = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x70\xf5\xf1\xf1\x57\xe4\x02\x04\x00\x00\xff\xff\x72\x1b\x50\xee\x07\x00\x00\x00" 314 315 func testDataCopyDirExtendsExpectedABytes() ([]byte, error) { 316 return bindataRead( 317 _testDataCopyDirExtendsExpectedA, 318 "test-data/copy-dir-extends-expected/a", 319 ) 320 } 321 322 func testDataCopyDirExtendsExpectedA() (*asset, error) { 323 bytes, err := testDataCopyDirExtendsExpectedABytes() 324 if err != nil { 325 return nil, err 326 } 327 328 info := bindataFileInfo{name: "test-data/copy-dir-extends-expected/a", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 329 a := &asset{bytes: bytes, info: info} 330 return a, nil 331 } 332 333 var _testDataCopyDirExtendsExpectedBase = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x70\xf5\xf1\xf1\x57\xe4\x02\x04\x00\x00\xff\xff\x72\x1b\x50\xee\x07\x00\x00\x00" 334 335 func testDataCopyDirExtendsExpectedBaseBytes() ([]byte, error) { 336 return bindataRead( 337 _testDataCopyDirExtendsExpectedBase, 338 "test-data/copy-dir-extends-expected/base", 339 ) 340 } 341 342 func testDataCopyDirExtendsExpectedBase() (*asset, error) { 343 bytes, err := testDataCopyDirExtendsExpectedBaseBytes() 344 if err != nil { 345 return nil, err 346 } 347 348 info := bindataFileInfo{name: "test-data/copy-dir-extends-expected/base", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 349 a := &asset{bytes: bytes, info: info} 350 return a, nil 351 } 352 353 var _testDataCopyDirExtendsVarATpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xaa\x56\x55\x48\xad\x28\x49\xcd\x4b\x29\x56\x50\x4a\x4a\x2c\x4e\xd5\x2b\x29\xc8\x51\x52\x50\xad\xe5\xe2\x02\xca\x24\xe5\xe4\x27\x67\x2b\xa4\xe5\xe7\x03\x05\xc2\x3d\x1c\x43\x40\x8a\xf3\x52\x20\xa2\x40\x25\x80\x00\x00\x00\xff\xff\x9d\x4c\xa7\xf3\x3c\x00\x00\x00" 354 355 func testDataCopyDirExtendsVarATplBytes() ([]byte, error) { 356 return bindataRead( 357 _testDataCopyDirExtendsVarATpl, 358 "test-data/copy-dir-extends-var/a.tpl", 359 ) 360 } 361 362 func testDataCopyDirExtendsVarATpl() (*asset, error) { 363 bytes, err := testDataCopyDirExtendsVarATplBytes() 364 if err != nil { 365 return nil, err 366 } 367 368 info := bindataFileInfo{name: "test-data/copy-dir-extends-var/a.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 369 a := &asset{bytes: bytes, info: info} 370 return a, nil 371 } 372 373 var _testDataCopyDirExtendsVarBaseTpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\x57\xa8\xae\x56\x28\x4b\xcc\x29\x4d\x55\xa8\xad\xe5\xe2\xaa\x56\x55\x48\xca\xc9\x4f\xce\x56\x48\xcb\xcf\x57\x50\xad\x05\x72\x53\xf3\x52\x20\x22\xaa\x40\xe9\xa4\xc4\x22\x2e\x40\x00\x00\x00\xff\xff\xf8\xea\x6e\xfb\x36\x00\x00\x00" 374 375 func testDataCopyDirExtendsVarBaseTplBytes() ([]byte, error) { 376 return bindataRead( 377 _testDataCopyDirExtendsVarBaseTpl, 378 "test-data/copy-dir-extends-var/base.tpl", 379 ) 380 } 381 382 func testDataCopyDirExtendsVarBaseTpl() (*asset, error) { 383 bytes, err := testDataCopyDirExtendsVarBaseTplBytes() 384 if err != nil { 385 return nil, err 386 } 387 388 info := bindataFileInfo{name: "test-data/copy-dir-extends-var/base.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 389 a := &asset{bytes: bytes, info: info} 390 return a, nil 391 } 392 393 var _testDataCopyDirExtendsVarExpectedA = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\x57\x48\xcb\xcf\xe7\xe2\x0a\xf7\x70\x0c\xe1\xe2\x4a\x4a\x2c\xe2\x02\x04\x00\x00\xff\xff\x22\xf4\xc2\x1f\x15\x00\x00\x00" 394 395 func testDataCopyDirExtendsVarExpectedABytes() ([]byte, error) { 396 return bindataRead( 397 _testDataCopyDirExtendsVarExpectedA, 398 "test-data/copy-dir-extends-var-expected/a", 399 ) 400 } 401 402 func testDataCopyDirExtendsVarExpectedA() (*asset, error) { 403 bytes, err := testDataCopyDirExtendsVarExpectedABytes() 404 if err != nil { 405 return nil, err 406 } 407 408 info := bindataFileInfo{name: "test-data/copy-dir-extends-var-expected/a", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 409 a := &asset{bytes: bytes, info: info} 410 return a, nil 411 } 412 413 var _testDataCopyDirExtendsVarExpectedBase = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\x57\x48\xcb\xcf\xe7\x02\x82\xa4\xc4\x22\x2e\x40\x00\x00\x00\xff\xff\x91\xf4\xda\x41\x11\x00\x00\x00" 414 415 func testDataCopyDirExtendsVarExpectedBaseBytes() ([]byte, error) { 416 return bindataRead( 417 _testDataCopyDirExtendsVarExpectedBase, 418 "test-data/copy-dir-extends-var-expected/base", 419 ) 420 } 421 422 func testDataCopyDirExtendsVarExpectedBase() (*asset, error) { 423 bytes, err := testDataCopyDirExtendsVarExpectedBaseBytes() 424 if err != nil { 425 return nil, err 426 } 427 428 info := bindataFileInfo{name: "test-data/copy-dir-extends-var-expected/base", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 429 a := &asset{bytes: bytes, info: info} 430 return a, nil 431 } 432 433 var _testDataCopyDirIncludeATpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\xe7\xe2\xaa\x56\x55\xc8\xcc\x4b\xce\x29\x4d\x49\x55\x50\x4a\x52\x52\x50\xad\xe5\x72\xcb\xcf\xe7\x02\x04\x00\x00\xff\xff\x97\xd1\xc7\xfd\x1d\x00\x00\x00" 434 435 func testDataCopyDirIncludeATplBytes() ([]byte, error) { 436 return bindataRead( 437 _testDataCopyDirIncludeATpl, 438 "test-data/copy-dir-include/a.tpl", 439 ) 440 } 441 442 func testDataCopyDirIncludeATpl() (*asset, error) { 443 bytes, err := testDataCopyDirIncludeATplBytes() 444 if err != nil { 445 return nil, err 446 } 447 448 info := bindataFileInfo{name: "test-data/copy-dir-include/a.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 449 a := &asset{bytes: bytes, info: info} 450 return a, nil 451 } 452 453 var _testDataCopyDirIncludeB = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x0a\xcf\x2f\xca\x49\xe1\x02\x04\x00\x00\xff\xff\x9e\x64\x94\xda\x06\x00\x00\x00" 454 455 func testDataCopyDirIncludeBBytes() ([]byte, error) { 456 return bindataRead( 457 _testDataCopyDirIncludeB, 458 "test-data/copy-dir-include/b", 459 ) 460 } 461 462 func testDataCopyDirIncludeB() (*asset, error) { 463 bytes, err := testDataCopyDirIncludeBBytes() 464 if err != nil { 465 return nil, err 466 } 467 468 info := bindataFileInfo{name: "test-data/copy-dir-include/b", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 469 a := &asset{bytes: bytes, info: info} 470 return a, nil 471 } 472 473 var _testDataCopyDirIncludeExpectedA = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\xe7\xe2\x0a\xcf\x2f\xca\x49\xe1\xe2\x72\xcb\xcf\xe7\x02\x04\x00\x00\xff\xff\x35\x22\xeb\x9d\x12\x00\x00\x00" 474 475 func testDataCopyDirIncludeExpectedABytes() ([]byte, error) { 476 return bindataRead( 477 _testDataCopyDirIncludeExpectedA, 478 "test-data/copy-dir-include-expected/a", 479 ) 480 } 481 482 func testDataCopyDirIncludeExpectedA() (*asset, error) { 483 bytes, err := testDataCopyDirIncludeExpectedABytes() 484 if err != nil { 485 return nil, err 486 } 487 488 info := bindataFileInfo{name: "test-data/copy-dir-include-expected/a", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 489 a := &asset{bytes: bytes, info: info} 490 return a, nil 491 } 492 493 var _testDataCopyDirIncludeExpectedB = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x0a\xcf\x2f\xca\x49\xe1\x02\x04\x00\x00\xff\xff\x9e\x64\x94\xda\x06\x00\x00\x00" 494 495 func testDataCopyDirIncludeExpectedBBytes() ([]byte, error) { 496 return bindataRead( 497 _testDataCopyDirIncludeExpectedB, 498 "test-data/copy-dir-include-expected/b", 499 ) 500 } 501 502 func testDataCopyDirIncludeExpectedB() (*asset, error) { 503 bytes, err := testDataCopyDirIncludeExpectedBBytes() 504 if err != nil { 505 return nil, err 506 } 507 508 info := bindataFileInfo{name: "test-data/copy-dir-include-expected/b", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 509 a := &asset{bytes: bytes, info: info} 510 return a, nil 511 } 512 513 var _testDataCopyDirSharedATpl = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xaa\x56\x55\x48\xad\x28\x49\xcd\x4b\x29\x56\x50\x4a\xcb\xcf\xb7\x4a\x49\x2c\x49\xd4\x4f\x4a\x2c\x4e\xd5\x2b\x29\xc8\x51\x52\x50\xad\xe5\x02\x04\x00\x00\xff\xff\x50\xc2\x51\x17\x22\x00\x00\x00" 514 515 func testDataCopyDirSharedATplBytes() ([]byte, error) { 516 return bindataRead( 517 _testDataCopyDirSharedATpl, 518 "test-data/copy-dir-shared/a.tpl", 519 ) 520 } 521 522 func testDataCopyDirSharedATpl() (*asset, error) { 523 bytes, err := testDataCopyDirSharedATplBytes() 524 if err != nil { 525 return nil, err 526 } 527 528 info := bindataFileInfo{name: "test-data/copy-dir-shared/a.tpl", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 529 a := &asset{bytes: bytes, info: info} 530 return a, nil 531 } 532 533 var _testDataCopyDirSharedExpectedA = "\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xf2\x48\xcd\xc9\xc9\x57\x48\x2b\xca\xcf\x55\x28\x49\x2d\x2e\xe1\x02\x04\x00\x00\xff\xff\x3c\x1f\x65\x35\x10\x00\x00\x00" 534 535 func testDataCopyDirSharedExpectedABytes() ([]byte, error) { 536 return bindataRead( 537 _testDataCopyDirSharedExpectedA, 538 "test-data/copy-dir-shared-expected/a", 539 ) 540 } 541 542 func testDataCopyDirSharedExpectedA() (*asset, error) { 543 bytes, err := testDataCopyDirSharedExpectedABytes() 544 if err != nil { 545 return nil, err 546 } 547 548 info := bindataFileInfo{name: "test-data/copy-dir-shared-expected/a", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} 549 a := &asset{bytes: bytes, info: info} 550 return a, nil 551 } 552 553 // Asset loads and returns the asset for the given name. 554 // It returns an error if the asset could not be found or 555 // could not be loaded. 556 func Asset(name string) ([]byte, error) { 557 cannonicalName := strings.Replace(name, "\\", "/", -1) 558 if f, ok := _bindata[cannonicalName]; ok { 559 a, err := f() 560 if err != nil { 561 return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) 562 } 563 return a.bytes, nil 564 } 565 return nil, fmt.Errorf("Asset %s not found", name) 566 } 567 568 // MustAsset is like Asset but panics when Asset would return an error. 569 // It simplifies safe initialization of global variables. 570 func MustAsset(name string) []byte { 571 a, err := Asset(name) 572 if err != nil { 573 panic("asset: Asset(" + name + "): " + err.Error()) 574 } 575 576 return a 577 } 578 579 // AssetInfo loads and returns the asset info for the given name. 580 // It returns an error if the asset could not be found or 581 // could not be loaded. 582 func AssetInfo(name string) (os.FileInfo, error) { 583 cannonicalName := strings.Replace(name, "\\", "/", -1) 584 if f, ok := _bindata[cannonicalName]; ok { 585 a, err := f() 586 if err != nil { 587 return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) 588 } 589 return a.info, nil 590 } 591 return nil, fmt.Errorf("AssetInfo %s not found", name) 592 } 593 594 // AssetNames returns the names of the assets. 595 func AssetNames() []string { 596 names := make([]string, 0, len(_bindata)) 597 for name := range _bindata { 598 names = append(names, name) 599 } 600 return names 601 } 602 603 // _bindata is a table, holding each asset generator, mapped to its name. 604 var _bindata = map[string]func() (*asset, error){ 605 "test-data/copy-dir-basic/a.txt": testDataCopyDirBasicATxt, 606 "test-data/copy-dir-basic/b.txt": testDataCopyDirBasicBTxt, 607 "test-data/copy-dir-basic/dir/c.txt": testDataCopyDirBasicDirCTxt, 608 "test-data/copy-dir-basic/t.tpl": testDataCopyDirBasicTTpl, 609 "test-data/copy-dir-basic-expected/a.txt": testDataCopyDirBasicExpectedATxt, 610 "test-data/copy-dir-basic-expected/b.txt": testDataCopyDirBasicExpectedBTxt, 611 "test-data/copy-dir-basic-expected/dir/c.txt": testDataCopyDirBasicExpectedDirCTxt, 612 "test-data/copy-dir-basic-expected/t": testDataCopyDirBasicExpectedT, 613 "test-data/copy-dir-extends/a.tpl": testDataCopyDirExtendsATpl, 614 "test-data/copy-dir-extends/base": testDataCopyDirExtendsBase, 615 "test-data/copy-dir-extends/base.tpl": testDataCopyDirExtendsBaseTpl, 616 "test-data/copy-dir-extends-expected/a": testDataCopyDirExtendsExpectedA, 617 "test-data/copy-dir-extends-expected/base": testDataCopyDirExtendsExpectedBase, 618 "test-data/copy-dir-extends-var/a.tpl": testDataCopyDirExtendsVarATpl, 619 "test-data/copy-dir-extends-var/base.tpl": testDataCopyDirExtendsVarBaseTpl, 620 "test-data/copy-dir-extends-var-expected/a": testDataCopyDirExtendsVarExpectedA, 621 "test-data/copy-dir-extends-var-expected/base": testDataCopyDirExtendsVarExpectedBase, 622 "test-data/copy-dir-include/a.tpl": testDataCopyDirIncludeATpl, 623 "test-data/copy-dir-include/b": testDataCopyDirIncludeB, 624 "test-data/copy-dir-include-expected/a": testDataCopyDirIncludeExpectedA, 625 "test-data/copy-dir-include-expected/b": testDataCopyDirIncludeExpectedB, 626 "test-data/copy-dir-shared/a.tpl": testDataCopyDirSharedATpl, 627 "test-data/copy-dir-shared-expected/a": testDataCopyDirSharedExpectedA, 628 } 629 630 // AssetDir returns the file names below a certain 631 // directory embedded in the file by go-bindata. 632 // For example if you run go-bindata on data/... and data contains the 633 // following hierarchy: 634 // data/ 635 // foo.txt 636 // img/ 637 // a.png 638 // b.png 639 // then AssetDir("data") would return []string{"foo.txt", "img"} 640 // AssetDir("data/img") would return []string{"a.png", "b.png"} 641 // AssetDir("foo.txt") and AssetDir("notexist") would return an error 642 // AssetDir("") will return []string{"data"}. 643 func AssetDir(name string) ([]string, error) { 644 node := _bintree 645 if len(name) != 0 { 646 cannonicalName := strings.Replace(name, "\\", "/", -1) 647 pathList := strings.Split(cannonicalName, "/") 648 for _, p := range pathList { 649 node = node.Children[p] 650 if node == nil { 651 return nil, fmt.Errorf("Asset %s not found", name) 652 } 653 } 654 } 655 if node.Func != nil { 656 return nil, fmt.Errorf("Asset %s not found", name) 657 } 658 rv := make([]string, 0, len(node.Children)) 659 for childName := range node.Children { 660 rv = append(rv, childName) 661 } 662 return rv, nil 663 } 664 665 type bintree struct { 666 Func func() (*asset, error) 667 Children map[string]*bintree 668 } 669 var _bintree = &bintree{nil, map[string]*bintree{ 670 "test-data": &bintree{nil, map[string]*bintree{ 671 "copy-dir-basic": &bintree{nil, map[string]*bintree{ 672 "a.txt": &bintree{testDataCopyDirBasicATxt, map[string]*bintree{}}, 673 "b.txt": &bintree{testDataCopyDirBasicBTxt, map[string]*bintree{}}, 674 "dir": &bintree{nil, map[string]*bintree{ 675 "c.txt": &bintree{testDataCopyDirBasicDirCTxt, map[string]*bintree{}}, 676 }}, 677 "t.tpl": &bintree{testDataCopyDirBasicTTpl, map[string]*bintree{}}, 678 }}, 679 "copy-dir-basic-expected": &bintree{nil, map[string]*bintree{ 680 "a.txt": &bintree{testDataCopyDirBasicExpectedATxt, map[string]*bintree{}}, 681 "b.txt": &bintree{testDataCopyDirBasicExpectedBTxt, map[string]*bintree{}}, 682 "dir": &bintree{nil, map[string]*bintree{ 683 "c.txt": &bintree{testDataCopyDirBasicExpectedDirCTxt, map[string]*bintree{}}, 684 }}, 685 "t": &bintree{testDataCopyDirBasicExpectedT, map[string]*bintree{}}, 686 }}, 687 "copy-dir-extends": &bintree{nil, map[string]*bintree{ 688 "a.tpl": &bintree{testDataCopyDirExtendsATpl, map[string]*bintree{}}, 689 "base": &bintree{testDataCopyDirExtendsBase, map[string]*bintree{}}, 690 "base.tpl": &bintree{testDataCopyDirExtendsBaseTpl, map[string]*bintree{}}, 691 }}, 692 "copy-dir-extends-expected": &bintree{nil, map[string]*bintree{ 693 "a": &bintree{testDataCopyDirExtendsExpectedA, map[string]*bintree{}}, 694 "base": &bintree{testDataCopyDirExtendsExpectedBase, map[string]*bintree{}}, 695 }}, 696 "copy-dir-extends-var": &bintree{nil, map[string]*bintree{ 697 "a.tpl": &bintree{testDataCopyDirExtendsVarATpl, map[string]*bintree{}}, 698 "base.tpl": &bintree{testDataCopyDirExtendsVarBaseTpl, map[string]*bintree{}}, 699 }}, 700 "copy-dir-extends-var-expected": &bintree{nil, map[string]*bintree{ 701 "a": &bintree{testDataCopyDirExtendsVarExpectedA, map[string]*bintree{}}, 702 "base": &bintree{testDataCopyDirExtendsVarExpectedBase, map[string]*bintree{}}, 703 }}, 704 "copy-dir-include": &bintree{nil, map[string]*bintree{ 705 "a.tpl": &bintree{testDataCopyDirIncludeATpl, map[string]*bintree{}}, 706 "b": &bintree{testDataCopyDirIncludeB, map[string]*bintree{}}, 707 }}, 708 "copy-dir-include-expected": &bintree{nil, map[string]*bintree{ 709 "a": &bintree{testDataCopyDirIncludeExpectedA, map[string]*bintree{}}, 710 "b": &bintree{testDataCopyDirIncludeExpectedB, map[string]*bintree{}}, 711 }}, 712 "copy-dir-shared": &bintree{nil, map[string]*bintree{ 713 "a.tpl": &bintree{testDataCopyDirSharedATpl, map[string]*bintree{}}, 714 }}, 715 "copy-dir-shared-expected": &bintree{nil, map[string]*bintree{ 716 "a": &bintree{testDataCopyDirSharedExpectedA, map[string]*bintree{}}, 717 }}, 718 }}, 719 }} 720 721 // RestoreAsset restores an asset under the given directory 722 func RestoreAsset(dir, name string) error { 723 data, err := Asset(name) 724 if err != nil { 725 return err 726 } 727 info, err := AssetInfo(name) 728 if err != nil { 729 return err 730 } 731 err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) 732 if err != nil { 733 return err 734 } 735 err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) 736 if err != nil { 737 return err 738 } 739 err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) 740 if err != nil { 741 return err 742 } 743 return nil 744 } 745 746 // RestoreAssets restores an asset under the given directory recursively 747 func RestoreAssets(dir, name string) error { 748 children, err := AssetDir(name) 749 // File 750 if err != nil { 751 return RestoreAsset(dir, name) 752 } 753 // Dir 754 for _, child := range children { 755 err = RestoreAssets(dir, filepath.Join(name, child)) 756 if err != nil { 757 return err 758 } 759 } 760 return nil 761 } 762 763 func _filePath(dir, name string) string { 764 cannonicalName := strings.Replace(name, "\\", "/", -1) 765 return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) 766 } 767