/usr/share/augeas/lenses/dist/tests/test_aptconf.aug is in augeas-lenses 1.2.0-0ubuntu1.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | module Test_aptconf =
(* Test multiline C-style comments *)
let comment_multiline = "/* This is a long
/* multiline
comment
*/
"
test AptConf.comment get comment_multiline =
{ "#mcomment"
{ "1" = "This is a long" }
{ "2" = "/* multiline" }
{ "3" = "comment" } }
(* Test empty multiline C-style comments *)
let comment_multiline_empty = "/* */\n"
test AptConf.empty get comment_multiline_empty = { }
(* Test a simple entry *)
let simple_entry = "APT::Clean-Installed \"true\";\n"
test AptConf.entry get simple_entry =
{ "APT" { "Clean-Installed" = "true" } }
(* Test simple recursivity *)
let simple_recursion = "APT { Clean-Installed \"true\"; };\n"
test AptConf.entry get simple_recursion =
{ "APT" { "Clean-Installed" = "true" } }
(* Test simple recursivity with several entries *)
let simple_recursion_multi =
"APT {
Clean-Installed \"true\";
Get::Assume-Yes \"true\";
}\n"
test AptConf.entry get simple_recursion_multi =
{ "APT"
{ "Clean-Installed" = "true" }
{ "Get" { "Assume-Yes" = "true" } } }
(* Test multiple recursivity *)
let multiple_recursion =
"APT { Get { Assume-Yes \"true\"; } };\n"
test AptConf.entry get multiple_recursion =
{ "APT" { "Get" { "Assume-Yes" = "true" } } }
(* Test simple list *)
let simple_list = "DPKG::options { \"--force-confold\"; }\n"
test AptConf.entry get simple_list =
{ "DPKG" { "options" { "@elem" = "--force-confold" } } }
(* Test list elements with spaces *)
let list_spaces = "Unattended-Upgrade::Allowed-Origins {
\"Ubuntu lucid-security\"; };\n"
test AptConf.entry get list_spaces =
{ "Unattended-Upgrade" { "Allowed-Origins"
{ "@elem" = "Ubuntu lucid-security" } } }
(* Test recursive list *)
let recursive_list =
"DPKG {
options {
\"--force-confold\";
\"--nocheck\";
} };\n"
test AptConf.entry get recursive_list =
{ "DPKG"
{ "options"
{ "@elem" = "--force-confold" }
{ "@elem" = "--nocheck" } } }
(* Test empty group *)
let empty_group =
"APT\n{\n};\n"
test AptConf.entry get empty_group = { "APT" }
(* Test #include *)
let include = " #include /path/to/file\n"
test AptConf.include get include =
{ "#include" = "/path/to/file" }
(* Test #clear *)
let clear = "#clear Dpkg::options Apt::Get::Assume-Yes\n"
test AptConf.clear get clear =
{ "#clear"
{ "name" = "Dpkg::options" }
{ "name" = "Apt::Get::Assume-Yes" } }
(* Test put simple value *)
test AptConf.entry put "APT::Clean-Installed \"true\";\n"
after set "/APT/Clean-Installed" "false" =
"APT {\nClean-Installed \"false\";\n};\n"
(* Test rm everything *)
test AptConf.entry put "APT { Clean-Installed \"true\"; }\n"
after rm "/APT" = ""
(* Test rm on recursive value *)
test AptConf.entry put "APT { Clean-Installed \"true\"; }\n"
after rm "/APT/Clean-Installed" = "APT { }\n"
(* Test put recursive value *)
test AptConf.entry put "APT { Clean-Installed \"true\"; }\n"
after set "/APT/Clean-Installed" "false" =
"APT { Clean-Installed \"false\"; }\n"
(* Test multiple lens *)
let multiple_entries =
"APT { Clean-Installed \"true\"; }\n
APT::Clean-Installed \"true\";\n"
test AptConf.lns get multiple_entries =
{ "APT" { "Clean-Installed" = "true" } }
{}
{ "APT" { "Clean-Installed" = "true" } }
(* Test with full lens *)
test AptConf.lns put "APT { Clean-Installed \"true\"; }\n"
after set "/APT/Clean-Installed" "false" =
"APT { Clean-Installed \"false\"; }\n"
(* Test single commented entry *)
let commented_entry =
"Unattended-Upgrade::Allowed-Origins {
\"Ubuntu lucid-security\";
// \"Ubuntu lucid-updates\";
};\n"
test AptConf.lns get commented_entry =
{ "Unattended-Upgrade" { "Allowed-Origins"
{ "@elem" = "Ubuntu lucid-security" }
{ "#comment" = "\"Ubuntu lucid-updates\";" } } }
(* Test multiple commented entries *)
let commented_entries =
"// List of packages to not update
Unattended-Upgrade::Package-Blacklist {
// \"vim\";
// \"libc6\";
// \"libc6-dev\";
// \"libc6-i686\"
};
"
test AptConf.lns get commented_entries =
{ "#comment" = "List of packages to not update" }
{ "Unattended-Upgrade" { "Package-Blacklist"
{ "#comment" = "\"vim\";" }
{ "#comment" = "\"libc6\";" }
{ "#comment" = "\"libc6-dev\";" }
{ "#comment" = "\"libc6-i686\"" }
} }
(* Test complex elem *)
let complex_elem = "DPkg::Post-Invoke {\"if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi; if [ -e /var/lib/update-notifier/updates-available ]; then echo > /var/lib/update-notifier/updates-available; fi \"};\n"
test AptConf.lns get complex_elem =
{ "DPkg" { "Post-Invoke"
{ "@elem" = "if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi; if [ -e /var/lib/update-notifier/updates-available ]; then echo > /var/lib/update-notifier/updates-available; fi " } } }
|