Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.141.25.100
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/share/augeas/lenses/dist/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/augeas/lenses/dist/tests/test_xendconfsxp.aug
module Test_xendconfsxp =

 (* Empty file and comments *)

 test Xendconfsxp.lns get "\n" = { }

 test Xendconfsxp.lns get "# my comment\n" =
   { "#scomment" = " my comment" }

 test Xendconfsxp.lns get " \n# my comment\n" =
   { }
   { "#scomment" = " my comment" }

 test Xendconfsxp.lns get "# my comment\n\n" =
   { "#scomment" = " my comment" }
   { }

 test Xendconfsxp.lns get "# my comment\n \n" =
   { "#scomment" = " my comment" }
   { }

 test Xendconfsxp.lns get "# my comment\n#com2\n" =
   { "#scomment" = " my comment" }
   { "#scomment" = "com2" }

 test Xendconfsxp.lns get "# my comment\n\n" =
   { "#scomment" = " my comment" }
   { }

 test Xendconfsxp.lns get "\n# my comment\n" =
   { }
   { "#scomment" = " my comment" }

 test Xendconfsxp.lns get "(key value)" =
   { "key" { "item" = "value" } }

 test Xendconfsxp.lns get "(key value)\n# com\n" =
   { "key" { "item" = "value" } }
   { }
   { "#scomment" = " com" }

 test Xendconfsxp.lns get "(k2ey value)" =
   { "k2ey" { "item" = "value" } }

 test Xendconfsxp.lns get "(- value)" =
   { "-" { "item" = "value" } }

 test Xendconfsxp.lns get "(-bar value)" =
   { "-bar" { "item" = "value" } }

 test Xendconfsxp.lns get "(k-ey v-alue)\n# com\n" =
   { "k-ey" { "item" = "v-alue" } }
   { }
   { "#scomment" = " com" }

 test Xendconfsxp.lns get "(key value)" =
   { "key" { "item" = "value" } }

 test Xendconfsxp.lns get "(key value)(key2 value2)" =
   { "key"
     { "item" = "value" }
   }
   { "key2"
     { "item" = "value2" }
   }

 test Xendconfsxp.lns get "( key value )( key2 value2 )" =
   { "key"
     { "item" = "value" }
   }
   { "key2"
     { "item" = "value2" }
   }

 let source_7 = "(key value)(key2 value2)"
 test Xendconfsxp.lns get source_7 =
   { "key"
     { "item" = "value" }
   }
   { "key2"
     { "item" = "value2" }
   }

(* 2 items?  it is a key/item *)

 test Xendconfsxp.lns get "(key value)" =
   { "key"
     { "item" = "value" }
   }

 test Xendconfsxp.lns get "( key value )" =
   { "key"
     { "item" = "value" }
   }

(* 3 items?  Not allowed. 2nd item must be in ()'s *)
 test Xendconfsxp.lns get "(key value value2)" = *

(* key/list pairs. *)

(* 0 item -- TODO: implement this. *)

 test Xendconfsxp.lns get "( key ())" = *

(* 1 item *)

 test Xendconfsxp.lns get "(key (listitem1) )" =
   { "key"
     { "array"
       { "item" = "listitem1" }
     }
   }

 test Xendconfsxp.lns get "(key ( (foo bar bar bat ) ) )" =
   { "key"
     { "array"
       { "array"
         { "item" = "foo" }
         { "item" = "bar" }
         { "item" = "bar" }
         { "item" = "bat" }
       }
     }
   }

 test Xendconfsxp.lns get "(key ((foo foo foo (bar bar bar))))" =
   { "key"
     { "array"
       { "array"
         { "item" = "foo" }
         { "item" = "foo" }
         { "item" = "foo" }
         { "array"
           { "item" = "bar" }
           { "item" = "bar" }
           { "item" = "bar" }
         }
       }
     }
   }

(* 2 item *)

 test Xendconfsxp.lns get "(xen-api-server (foo bar))" =
   { "xen-api-server"
     { "array"
       { "item" = "foo" }
       { "item" = "bar" }
     }
   }

 test Xendconfsxp.lns get "( key ( value value2 ))" =
   { "key"
     { "array"
       { "item" = "value" }
       { "item" = "value2" }
     }
   }

(* 3 item *)

 test Xendconfsxp.lns get "( key ( value value2 value3 ))" =
   { "key"
     { "array"
       { "item" = "value" }
       { "item" = "value2" }
       { "item" = "value3" }
     }
   }

(* quotes *)
 test Xendconfsxp.lns get "(key \"foo\")" = { "key" { "item" = "\"foo\"" } }
 test Xendconfsxp.lns get "(key \"\")" = { "key" { "item" = "\"\"" } }
 test Xendconfsxp.lns get "( key \"foo\" )" = { "key" { "item" = "\"foo\"" } }
 test Xendconfsxp.lns get "( key \"f oo\" )" = { "key" { "item" = "\"f oo\"" } }
 test Xendconfsxp.lns get "( key \"f  oo\" )" = { "key" { "item" = "\"f  oo\"" } }
 test Xendconfsxp.lns get "(foo \"this is \\\"quoted\\\" in quotes\")" =
   { "foo" { "item" = "\"this is \\\"quoted\\\" in quotes\"" } }

 test Xendconfsxp.lns get "( key \"fo\\'\" )" = { "key" { "item" = "\"fo\\'\""} }
 test Xendconfsxp.lns get "( key \"fo\\'\" )" = { "key" { "item" = "\"fo\\'\""} }
 test Xendconfsxp.lns get "( key \"\")" = { "key" { "item" = "\"\"" } }

(* Newlines in strange places *)
 test Xendconfsxp.lns get "(\nkey\nbar\n)" = { "key" { "item" = "bar" } }
 test Xendconfsxp.lns get "(\n\n\nkey\n\n\nbar\n\n\n)" = { "key" { "item" = "bar" } }
 test Xendconfsxp.lns get "(\nkey\nbar\n)" = { "key" { "item" = "bar" } }

(* Comments in strange places *)
 test Xendconfsxp.lns get "(\nkey #aa\nbar)" =
   { "key"
     { "#comment" = "aa" }
     { "item" = "bar" }
   }

 test Xendconfsxp.lns get "(\nkey\n#aa\nbar)" =
   { "key"
     { "#comment" = "aa" }
     { "item" = "bar" }
   }

 test Xendconfsxp.lns get "(\nkey\n #aa\nbar)" =
   { "key"
     { "#comment" = "aa" }
     { "item" = "bar" }
   }

(* Comments must have 1 space before the # *)
 test Xendconfsxp.lns get "(\nkey# com\nbar\n)" = *
 test Xendconfsxp.lns get "(\nkey#aa\nbar)" = *

(* Comments may start a line *)
 test Xendconfsxp.lns get "(\nkey\n# com\nbar)" =
   { "key"
     { "#comment" = "com" }
     { "item" = "bar" }
   }
 test Xendconfsxp.lns get "(\nkey\n#aa\nbar)" =
   { "key"
     { "#comment" = "aa" }
     { "item" = "bar" }
   }

(* Sub lists *)
 test Xendconfsxp.lns get "(key ((foo foo) (bar bar)))" =
   { "key"
     { "array"
       { "array"
         { "item" = "foo" }
         { "item" = "foo" }
       }
       { "array"
         { "item" = "bar" }
         { "item" = "bar" }
       }
     }
   }


 test Xendconfsxp.lns get "(aaa ((bbb ccc ddd) (eee fff)))" =
   { "aaa"
     { "array"
       { "array"
         { "item" = "bbb" }
         { "item" = "ccc" }
         { "item" = "ddd" }
       }
       { "array"
         { "item" = "eee" }
         { "item" = "fff" }
       }
     }
   }

(* Comments in strange places *)
 test Xendconfsxp.lns get "(\nkey\nbar # bb\n)" =
   { "key"
     { "item" = "bar" }
     { "#comment" = "bb" }
   }
 test Xendconfsxp.lns get "(\nkey\nbar \n#cc\n)" =
   { "key" { "item" = "bar" }
           { "#comment" = "cc" } }
 test Xendconfsxp.lns get "(\nkey\nbar \n #cc\n)" =
   { "key" { "item" = "bar" }
           { "#comment" = "cc" } }
 test Xendconfsxp.lns get "(\nkey\nbar \n #cc\n )" =
   { "key" { "item" = "bar" }
           { "#comment" = "cc" } }
 test Xendconfsxp.lns get "(foo ((foo foo foo) (unix none)))" =
   { "foo"
     { "array"
       { "array"
         { "item" = "foo" }
         { "item" = "foo" }
         { "item" = "foo" }
       }
       { "array"
         { "item" = "unix" }
         { "item" = "none" }
       }
     }
   }

 test Xendconfsxp.lns get "(foo ((foo foo 'foo') (unix none)))" =
   { "foo"
     { "array"
       { "array"
         { "item" = "foo" }
         { "item" = "foo" }
         { "item" = "'foo'" }
       }
       { "array"
         { "item" = "unix" }
         { "item" = "none" }
       }
     }
   }

 test Xendconfsxp.lns get "(xen-api-server ((9363 pam '^localhost$ example\\.com$') (unix none)))" =
   { "xen-api-server"
     { "array"
       { "array"
         { "item" = "9363" }
         { "item" = "pam" }
         { "item" = "'^localhost$ example\.com$'" }
       }
       { "array"
         { "item" = "unix" }
         { "item" = "none" }
       }
     }
   }

 test Xendconfsxp.lns get "# -*- sh -*-\n#foo\n#bar\n\n\n(foo bar)" =
   { "#scomment" = " -*- sh -*-" }
   { "#scomment" = "foo" }
   { "#scomment" = "bar" }
   {  }
   {  }
   { "foo"
     { "item" = "bar" }
   }

(* Test whitespace before lparen *)
 test Xendconfsxp.lns get  " (network-script network-bridge)\n#\n" =
   { "network-script" { "item" = "network-bridge" } }
                      {  }
                      { "#scomment" = "" }

(* Bugs: *)

(* Note: It works if you change the last \n to \t *)
 test Xendconfsxp.lns get "(\nkey\n# com\nbar\n)" = *

Anon7 - 2022
AnonSec Team