@@ -111,7 +111,8 @@ function test_unsuccessful_assert_is_directory_readable_when_a_file_is_given() {
111111}
112112
113113function test_unsuccessful_assert_is_directory_readable_without_execution_permission() {
114- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
114+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
115+ skip " permission checks unreliable as root"
115116 return
116117 fi
117118
@@ -126,7 +127,8 @@ function test_unsuccessful_assert_is_directory_readable_without_execution_permis
126127}
127128
128129function test_unsuccessful_assert_is_directory_readable_without_read_permission() {
129- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
130+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
131+ skip " permission checks unreliable as root"
130132 return
131133 fi
132134
@@ -141,7 +143,8 @@ function test_unsuccessful_assert_is_directory_readable_without_read_permission(
141143}
142144
143145function test_successful_assert_is_directory_not_readable_without_read_permission() {
144- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
146+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
147+ skip " permission checks unreliable as root"
145148 return
146149 fi
147150
@@ -152,7 +155,8 @@ function test_successful_assert_is_directory_not_readable_without_read_permissio
152155}
153156
154157function test_successful_assert_is_directory_not_readable_without_execution_permission() {
155- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
158+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
159+ skip " permission checks unreliable as root"
156160 return
157161 fi
158162
@@ -178,7 +182,8 @@ function test_successful_assert_is_directory_writable() {
178182}
179183
180184function test_unsuccessful_assert_is_directory_writable() {
181- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
185+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
186+ skip " permission checks unreliable as root"
182187 return
183188 fi
184189
@@ -202,7 +207,8 @@ function test_unsuccessful_assert_is_directory_writable_when_a_file_is_given() {
202207}
203208
204209function test_successful_assert_is_directory_not_writable() {
205- if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" ]]; then
210+ if [[ " $_OS " == " Windows" || $_DISTRO = " Alpine" || $( id -u) -eq 0 ]]; then
211+ skip " permission checks unreliable as root"
206212 return
207213 fi
208214
0 commit comments