Move getopts out of extra
getopts: replaced base functions with those from group
getopts: unify tests
getopts: fixed a failing test
auto merge of #12007 : Arcterus/rust/libgetopts, r=cmr

Should help towards finishing #8784.