Permalink
Browse files

利用可能なモジュールリストを表示できるようにした

  • Loading branch information...
1 parent 56e8d6b commit a0232d4602348f5a8f71f4b8b1975a60336c3309 @mzp committed Jan 11, 2010
Showing with 24 additions and 1 deletion.
  1. +12 −0 controller.ml
  2. +1 −0 controller.mli
  3. +11 −1 controllerTest.ml
View
@@ -84,3 +84,15 @@ let pagenation ~offset ~window xs =
end
)]
], HList.take window @@ HList.drop offset xs
+
+let available configs =
+ Table begin
+ List.map configs ~f:begin fun { Config.name = name; modules = modules} ->
+ ["package", String name;
+ "modules", Table begin
+ List.map modules ~f:begin fun s ->
+ ["name", String s]
+ end
+ end ]
+ end
+ end
View
@@ -5,3 +5,4 @@ type t =
val format : Config.t list -> Search.t -> (string * t) list
val pagenation : offset:int -> window:int -> 'a list -> (string * t) list * 'a list
+val available : Config.t list -> t
View
@@ -208,5 +208,15 @@ let _ = begin "controller.ml" >::: [
opt;
assert_equal (range 20 30) xs
end;
-
+ "available" >:: begin fun () ->
+ assert_equal (Table [
+ ["package", String "some package";
+ "modules", Table [
+ ["name", String "A"];
+ ["name", String "B"] ] ];
+ ["package", String "other package";
+ "modules", Table [
+ ["name", String "String"] ]]]) @@
+ available config
+ end
] end +> run_test_tt_main

0 comments on commit a0232d4

Please sign in to comment.