From a66f0688fd36fb3a10fb18b530d032c0524c69af Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Tue, 13 Dec 2011 19:59:12 -0800 Subject: [PATCH] getopts: add test for strings with spaces. --- src/test/stdtest/getopts.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/test/stdtest/getopts.rs b/src/test/stdtest/getopts.rs index 0cccbb4cb6ec..eafc5ba0b5d3 100644 --- a/src/test/stdtest/getopts.rs +++ b/src/test/stdtest/getopts.rs @@ -444,10 +444,11 @@ fn test_unrecognized_option_short() { fn test_combined() { let args = ["prog", "free1", "-s", "20", "free2", "--flag", "--long=30", "-f", - "-m", "40", "-m", "50"]; + "-m", "40", "-m", "50", "-n", "-A B", "-n", "-60 70"]; let opts = [opt::optopt("s"), opt::optflag("flag"), opt::reqopt("long"), - opt::optflag("f"), opt::optmulti("m"), opt::optopt("notpresent")]; + opt::optflag("f"), opt::optmulti("m"), opt::optmulti("n"), + opt::optopt("notpresent")]; let rs = opt::getopts(args, opts); alt rs { ok(m) { @@ -460,6 +461,8 @@ fn test_combined() { assert (opt::opt_present(m, "f")); assert (opt::opt_strs(m, "m")[0] == "40"); assert (opt::opt_strs(m, "m")[1] == "50"); + assert (opt::opt_strs(m, "n")[0] == "-A B"); + assert (opt::opt_strs(m, "n")[1] == "-60 70"); assert (!opt::opt_present(m, "notpresent")); } _ { fail; }