let height =
int_option
- ~default:600
+ ~default:(20 * 600)
~metavar:"<height>"
~short_name:'H'
~long_name:"height"
let main_class =
str_option
- ~default:"Main"
+ ~default:"boot.Boot"
~metavar:"<main_class>"
~short_name:'m'
~long_name:"main"
let parse argv =
let inputs =
- OptParser.parse opt_parser argv in
+ OptParser.parse ~first:1 opt_parser argv in
inputs,{|
color = (Opt.get red, Opt.get green, Opt.get blue);
main_class = Opt.get main_class;
open ExtString
let ok x f y =
- assert_equal ~printer:Std.dump x @@ f @@ snd @@ parse @@ Array.of_list @@ String.nsplit y " "
+ let argv =
+ Array.of_list @@ String.nsplit ("./foo " ^ y) " " in
+ assert_equal ~printer:Std.dump x @@ f @@ snd @@ parse argv
let _ = begin "cmdOpt.ml" >::: [
"filename" >:: begin fun () ->
- assert_equal ["foo"] @@ fst @@ parse [| "foo" |];
- assert_equal ["foo"; "bar"] @@ fst @@ parse [| "foo"; "bar" |]
+ assert_equal ["foo"] @@ fst @@ parse [| "./foo"; "foo" |];
+ assert_equal ["foo"; "bar"] @@ fst @@ parse [| "./foo"; "foo"; "bar" |]
end;
"size" >:: begin fun () ->
ok (100,200) (fun t -> t#size) "-W 100 -H 200";
ok (1,2,3) (fun t -> t#color) "--red=1 --green=2 --blue=3"
end;
"main class" >:: begin fun () ->
- ok "Main" (fun t -> t#main_class) "";
- ok "foo" (fun t -> t#main_class) "-m foo";
- ok "foo" (fun t -> t#main_class) "--main=foo"
+ ok "boot.Boot" (fun t -> t#main_class) "";
+ ok "foo" (fun t -> t#main_class) "-m foo";
+ ok "foo" (fun t -> t#main_class) "--main=foo"
end;
"out" >:: begin fun () ->
- ok "a.swf" (fun t -> t#output) "";
+ ok "a.swf" (fun t -> t#output) "";
ok "foo.swf" (fun t -> t#output) "-o foo.swf";
ok "foo.swf" (fun t -> t#output) "--output=foo.swf"
end;
bottom = snd t#size;
};
tags = [
- `FileAttributes { TagOut.is_as3=true; is_metadata=false; use_network=true };
+ `FileAttributes { TagOut.is_as3=true; is_metadata=true; use_network=true };
`SetBackgroundColor t#color;
`FrameLabel (t#main_class,false);
`DoABC(true,"frame",abc);
- `SymbolClass [(0, t#main_class)]
+ `SymbolClass [(0, t#main_class)];
+ `ShowFrame;
+ `End
]
}
-