bsdcontrol.rb/test/superuser/disable_feature_test.rb
0x1eef 275d622843 Map HBSDCTRL_STATE_(ENABLED|DISABLED) into Ruby
And fix `BSD::Control::Feature#disable!`.
2024-03-20 21:58:18 -03:00

31 lines
686 B
Ruby

require_relative "../setup"
module BSD::Control
class DisableFeatureTest < Test::Unit::TestCase
require 'fileutils'
include FileUtils
def test_disable_pageexec
touch(file)
assert BSD::Control.feature(:pageexec).disable!(file),
"The disable! method should have returned true"
assert_equal(
:disabled,
BSD::Control.feature(:pageexec).status(file)
)
ensure
rm(file)
end
def test_disable_pageexec_nonexistent_file
assert_raises(Errno::ENOENT) do
BSD::Control.feature(:pageexec).disable!(file)
end
end
private
def file
File.join(__dir__, "file")
end
end
end