Back on-list. On 10/04/2010 04:42 PM, Raphaƫl Pinson wrote: > 2010/10/4 Doug Warner <[email protected] <mailto:[email protected]>> > > I split out the tests like you recommended; I was mostly just doing it > that > way to keep it simple for the time being. > > Setting options without a value will probably be necessary; I know linux > can > take options like that for kernel boot options (flags like "rhgb" and the > like) and some modules might do the same thing. If you can point me at a > lens > that might do something similar I would appreciate it! > > Sure. See tests/test_mysql.aug for example. Usually what I do in this case is > that I actually give an empty value to the node. This is easier as it allows > to do a 'set /path/to/node ""' to create the node. >
That's what I'm trying to do in my test currently (set "/ip_gre/option2" "")
but I'm getting this error:
test_modulesautoload.aug:72.2-74.32:exception thrown in test
test_modulesautoload.aug:72.7-73.28:exception: Value '' does not match regexp
/[^ \t\n#:]+/ in store lens
Lens: ./modulesautoload.aug:19.32-.45:
Error encountered at path /ip_gre/option2
Attached is the tests I've created and lens that you modified.
-Doug
(* Parsing /etc/modules.autoload.d/* *)
module ModulesAutoload=
autoload xfm
let sep_tab = Util.del_ws_tab
let sep_spc = Util.del_ws_spc
let eol = Util.eol
let indent = Util.indent
let s = Sep.space
let comment = Util.comment
let word = Rx.word | Rx.integer
let empty = Util.empty
let eq = Util.del_str "="
let optword = /[^ \t\n#:]+/
let opt = [ key word . ( eq . store optword | empty ) ]
let record = [ key word . (s . Build.opt_list opt s)? . eol ]
let lns = ( empty | comment | record ) *
let xfm = transform lns (
incl "/etc/modules.autoload.d/*" .
Util.stdexcl
)
module Test_ModulesAutoload=
test ModulesAutoload.lns get "ip_gre\n" =
{ "ip_gre" }
test ModulesAutoload.lns get "ip_gre option1\n" =
{ "ip_gre"
{ "option1" }
}
test ModulesAutoload.lns get "ip_gre option1=a\n" =
{ "ip_gre"
{ "option1" = "a" }
}
test ModulesAutoload.lns get "ip_gre option1=a=b\n" =
{ "ip_gre"
{ "option1" = "a=b" }
}
test ModulesAutoload.lns get "ip_gre option1=a option2\n" =
{ "ip_gre"
{ "option1" = "a" }
{ "option2" }
}
test ModulesAutoload.lns get "ip_gre option1=a option2=b\n" =
{ "ip_gre"
{ "option1" = "a" }
{ "option2" = "b" }
}
test ModulesAutoload.lns get "ip_gre option1=a option2 option3=c\n" =
{ "ip_gre"
{ "option1" = "a" }
{ "option2" }
{ "option3" = "c" }
}
test ModulesAutoload.lns get "ip_gre option1=a\n8021q option2=b\n" =
{ "ip_gre"
{ "option1" = "a" }
}
{ "8021q"
{ "option2" = "b" }
}
test ModulesAutoload.lns get "ip_gre option1=a option2 option3=b\n8021q
option4=c option5 option6=d\n" =
{ "ip_gre"
{ "option1" = "a" }
{ "option2" }
{ "option3" = "b" }
}
{ "8021q"
{ "option4" = "c" }
{ "option5" }
{ "option6" = "d" }
}
test ModulesAutoload.lns put "" after
set "/ip_gre" ""
= "ip_gre\n"
test ModulesAutoload.lns put "ip_gre\n" after
set "/ip_gre/option1" "a"
= "ip_gre option1=a\n"
test ModulesAutoload.lns put "ip_gre\n" after
set "/ip_gre/option1" "a=b"
= "ip_gre option1=a=b\n"
test ModulesAutoload.lns put "ip_gre option1=a\n" after
set "/ip_gre/option2" ""
= "ip_gre option1=a option2\n"
test ModulesAutoload.lns put "ip_gre\n" after
set "/ip_gre/option1" "a" ;
set "/ip_gre/option3" "b"
= "ip_gre option1=a option3=b\n"
test ModulesAutoload.lns put "ip_gre option1=a option2 option3=b\n" after
rm "/ip_gre/option1"
= "ip_gre option2 option3=b\n"
test ModulesAutoload.lns put "ip_gre option1=a option2 option3=b\n" after
rm "/ip_gre/option2"
= "ip_gre option1=a option3=b\n"
signature.asc
Description: OpenPGP digital signature
_______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
