github.com/StackExchange/blackbox/v2@v2.0.1-0.20220331193400-d84e904973ab/bin/_blackbox_common_test.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  #
     4  # _blackbox_common_test.sh -- Unit tests of functions from _blackbox_common.sh
     5  #
     6  
     7  set -e
     8  . "${0%/*}/_blackbox_common.sh"
     9  . tools/test_functions.sh
    10  
    11  PHASE 'Test cp-permissions: TestA'
    12  touch TestA TestB TestC TestD
    13  chmod 0347 TestA
    14  chmod 0700 TestB
    15  chmod 0070 TestC
    16  chmod 0070 TestD
    17  cp_permissions TestA TestB TestC
    18  # NOTE: cp_permissions is not touching TestD.
    19  assert_file_perm '--wxr--rwx' TestA
    20  assert_file_perm '--wxr--rwx' TestB
    21  assert_file_perm '--wxr--rwx' TestC
    22  assert_file_perm '----rwx---' TestD  # TestD doesn't change.
    23  rm -f TestA TestB TestC TestD
    24  
    25  echo '========== DONE.'