Change record type to object type. Because, I want to use it over some modules.
open Base
open OptParse
-type t = {
- size : int * int;
- color : int * int * int;
- main_class : string
-}
+type t = <color:int*int*int; size:int*int; main_class:string>
let opt_parser =
OptParser.make
let parse argv =
let inputs =
OptParser.parse opt_parser argv in
- inputs,{
+ inputs,{|
color = (Opt.get red, Opt.get green, Opt.get blue);
main_class = Opt.get main_class;
size = (Opt.get width, Opt.get height)
- }
+ |}
let parse_argv () =
parse Sys.argv
-type t = {
- size : int * int;
- color : int * int * int;
- main_class : string
-}
+type t = <color:int*int*int; size:int*int; main_class:string>
+
val parse : string array -> string list * t
val parse_argv : unit -> string list * t
assert_equal ["foo"; "bar"] @@ fst @@ parse [| "foo"; "bar" |]
end;
"size" >:: begin fun () ->
- ok (100,200) (fun {size} -> size) "-W 100 -H 200";
- ok (100,200) (fun {size} -> size) "--width=100 --height=200";
+ ok (100,200) (fun t -> t#size) "-W 100 -H 200";
+ ok (100,200) (fun t -> t#size) "--width=100 --height=200";
end;
"color" >:: begin fun () ->
- ok (1,2,3) (fun {color}-> color) "--red=1 --green=2 --blue=3"
+ ok (1,2,3) (fun t -> t#color) "--red=1 --green=2 --blue=3"
end;
"main class" >:: begin fun () ->
- ok "foo" (fun {main_class}->main_class) "-m foo";
- ok "foo" (fun {main_class}->main_class) "--main=foo"
+ ok "foo" (fun t -> t#main_class) "-m foo";
+ ok "foo" (fun t -> t#main_class) "--main=foo"
end
] end +> run_test_tt_main
open Base
+open Swflib.SwfType
+(*<swf version="9" compressed="1">
+ <Header framerate="24" frames="1">
+ <size>
+ <Rectangle left="0" right="__WIDTH__" top="0" bottom="__HEIGHT__"/>
+ </size>
+ <tags>
+ <FileAttributes hasMetaData="1" allowABC="1" suppressCrossDomainCaching="0" swfRelativeURLs="0" useNetwork="1"/>
+ <SetBackgroundColor>
+ <color>
+ <Color red="__BG_RED__" green="__BG_GREEN__" blue="__BG_BLUE__"/>
+ </color>
+ </SetBackgroundColor>
+ <FrameLabel label="__MAIN_CLASS__">
+ <flags/>
+ </FrameLabel>
+ <DoABCDefine flags="1" name="frame1">
+ <actions>
+include(__ABCX__)
+</actions>
+ </DoABCDefine>
+ <SymbolClass>
+ <symbols>
+ <Symbol objectID="0" name="__MAIN_CLASS__"/>
+ </symbols>
+ </SymbolClass>
+ <ShowFrame/>
+ <End/>
+ </tags>
+ </Header>
+</swf>
+*)
let _ =
print_endline "hello"