2024-05-12 05:59:38 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-03-20 22:34:15 +01:00
|
|
|
require_relative "../setup"
|
|
|
|
module BSD::Control
|
2024-05-13 03:32:55 +02:00
|
|
|
class SysDefFeatureTest < BSD::Control::Test
|
2024-03-20 22:34:15 +01:00
|
|
|
def test_sysdef_pageexec
|
2024-10-13 07:05:01 +02:00
|
|
|
assert_equal true, feature(:pageexec).enable!(file)
|
|
|
|
assert_equal :enabled, feature(:pageexec).status(file)
|
|
|
|
assert_equal true, feature(:pageexec).sysdef!(file)
|
|
|
|
assert_equal :sysdef, feature(:pageexec).status(file)
|
2024-03-20 22:34:15 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_enable_pageexec_nonexistent_file
|
2024-05-13 03:32:55 +02:00
|
|
|
rm(file)
|
2024-10-13 07:05:01 +02:00
|
|
|
assert_raises(Errno::ENOENT) { feature(:pageexec).sysdef!(file) }
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def feature(name)
|
|
|
|
BSD::Control.feature(name)
|
2024-03-20 22:34:15 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|