github.com/keltia/go-ipfs@v0.3.8-0.20150909044612-210793031c63/test/sharness/t0042-add-skip.sh (about)

     1  #!/bin/sh
     2  #
     3  # Copyright (c) 2014 Christian Couder
     4  # MIT Licensed; see the LICENSE file in this repository.
     5  #
     6  
     7  test_description="Test add and cat commands"
     8  
     9  . lib/test-lib.sh
    10  
    11  test_add_skip() {
    12  
    13  	test_expect_success "'ipfs add -r' with hidden file succeeds" '
    14  		mkdir -p mountdir/planets/.asteroids &&
    15  		echo "Hello Mars" >mountdir/planets/mars.txt &&
    16  		echo "Hello Venus" >mountdir/planets/venus.txt &&
    17  		echo "Hello Pluto" >mountdir/planets/.pluto.txt &&
    18  		echo "Hello Charon" >mountdir/planets/.charon.txt &&
    19  		echo "Hello Ceres" >mountdir/planets/.asteroids/ceres.txt &&
    20  		echo "Hello Pallas" >mountdir/planets/.asteroids/pallas.txt &&
    21  		ipfs add -r mountdir/planets >actual
    22  	'
    23  
    24  	test_expect_success "'ipfs add -r' did not include . files" '
    25  		cat >expected <<-\EOF &&
    26  			added QmZy3khu7qf696i5HtkgL2NotsCZ8wzvNZJ1eUdA5n8KaV planets/mars.txt
    27  			added QmQnv4m3Q5512zgVtpbJ9z85osQrzZzGRn934AGh6iVEXz planets/venus.txt
    28  			added QmR8nD1Vzk5twWVC6oShTHvv7mMYkVh6dApCByBJyV2oj3 planets
    29  		EOF
    30  		test_cmp expected actual
    31  	'
    32  
    33  	test_expect_success "'ipfs add -r --hidden' succeeds" '
    34  		ipfs add -r --hidden mountdir/planets >actual
    35  	'
    36  
    37  	test_expect_success "'ipfs add -r --hidden' did include . files" '
    38  		cat >expected <<-\EOF &&
    39  			added QmcAREBcjgnUpKfyFmUGnfajA1NQS5ydqRp7WfqZ6JF8Dx planets/.asteroids/ceres.txt
    40  			added QmZ5eaLybJ5GUZBNwy24AA9EEDTDpA4B8qXnuN3cGxu2uF planets/.asteroids/pallas.txt
    41  			added Qmf6rbs5GF85anDuoxpSAdtuZPM9D2Yt3HngzjUVSQ7kDV planets/.asteroids
    42  			added QmaowqjedBkUrMUXgzt9c2ZnAJncM9jpJtkFfgdFstGr5a planets/.charon.txt
    43  			added QmU4zFD5eJtRBsWC63AvpozM9Atiadg9kPVTuTrnCYJiNF planets/.pluto.txt
    44  			added QmZy3khu7qf696i5HtkgL2NotsCZ8wzvNZJ1eUdA5n8KaV planets/mars.txt
    45  			added QmQnv4m3Q5512zgVtpbJ9z85osQrzZzGRn934AGh6iVEXz planets/venus.txt
    46  			added QmetajtFdmzhWYodAsZoVZSiqpeJDAiaw2NwbM3xcWcpDj planets
    47  		EOF
    48  		test_cmp expected actual
    49  	'
    50  
    51  }
    52  
    53  # should work offline
    54  test_init_ipfs
    55  test_add_skip
    56  
    57  # should work online
    58  test_launch_ipfs_daemon
    59  test_add_skip
    60  test_kill_ipfs_daemon
    61  
    62  test_done