Leo il y a 10 ans
Parent
commit
c783c257b0
6 fichiers modifiés avec 36 ajouts et 24 suppressions
  1. 1 1
      VERSION
  2. 1 1
      _oasis
  3. 4 5
      setup.ml
  4. 15 16
      src/edit_command.ml
  5. 1 1
      src/oclaunch.ml
  6. 14 0
      src/test/ec_t.ml

+ 1 - 1
VERSION

@@ -1 +1 @@
-0.2.2-dev
+

+ 1 - 1
_oasis

@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 OASISFormat: 0.4
 Name:        OcLaunch
 Name:        OcLaunch
-Version:     0.2.2-dev
+Version:     
 Synopsis:    Launch commands automagically
 Synopsis:    Launch commands automagically
 Authors:     Joly Clément <leowzukw@vmail.me>
 Authors:     Joly Clément <leowzukw@vmail.me>
 Maintainers: Joly Clément <leowzukw@vmail.me>
 Maintainers: Joly Clément <leowzukw@vmail.me>

+ 4 - 5
setup.ml

@@ -1,7 +1,7 @@
 (* setup.ml generated for the first time by OASIS v0.4.5 *)
 (* setup.ml generated for the first time by OASIS v0.4.5 *)
 
 
 (* OASIS_START *)
 (* OASIS_START *)
-(* DO NOT EDIT (digest: facda6205b6c2f62ccec277c5a0df974) *)
+(* DO NOT EDIT (digest: e85537f969feafc7b8eee94a9fce28c0) *)
 (*
 (*
    Regenerated by OASIS v0.4.5
    Regenerated by OASIS v0.4.5
    Visit http://oasis.forge.ocamlcore.org for more information and
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -6851,7 +6851,7 @@ let setup_t =
           alpha_features = ["stdfiles_markdown"; "compiled_setup_ml"];
           alpha_features = ["stdfiles_markdown"; "compiled_setup_ml"];
           beta_features = [];
           beta_features = [];
           name = "OcLaunch";
           name = "OcLaunch";
-          version = "0.2.2-dev";
+          version = "";
           license =
           license =
             OASISLicense.DEP5License
             OASISLicense.DEP5License
               (OASISLicense.DEP5Unit
               (OASISLicense.DEP5Unit
@@ -7019,8 +7019,7 @@ let setup_t =
        };
        };
      oasis_fn = Some "_oasis";
      oasis_fn = Some "_oasis";
      oasis_version = "0.4.5";
      oasis_version = "0.4.5";
-     oasis_digest =
-       Some "w\231\183\238E\027\192\029\180\212\172\209\001\200h\003";
+     oasis_digest = Some "\203\134\148\142Uh\206\188\027iR\241>##\179";
      oasis_exec = None;
      oasis_exec = None;
      oasis_setup_args = [];
      oasis_setup_args = [];
      setup_update = false
      setup_update = false
@@ -7028,6 +7027,6 @@ let setup_t =
 
 
 let setup () = BaseSetup.setup setup_t;;
 let setup () = BaseSetup.setup setup_t;;
 
 
-# 7032 "setup.ml"
+# 7031 "setup.ml"
 (* OASIS_STOP *)
 (* OASIS_STOP *)
 let () = setup ();;
 let () = setup ();;

+ 15 - 16
src/edit_command.ml

@@ -56,6 +56,21 @@ let new_list current_list position new_items =
 ;;
 ;;
 
 
 
 
+(* Concat edited item, to have a proper list to display
+    * If only one element, return "elt".
+    * If more than one "\nelt1\nelt2\nelt3" *)
+let rec gen_modification items =
+    let r = "\n" in
+    epur items
+    |> (function
+        | [] -> ""
+        (* Only one element *)
+        | element :: [] -> element
+        (* The list as more than two elements *)
+        | _ ->
+                let msg = String.concat ~sep:r items in
+                String.concat [ r ; msg ; r ])
+;;
 
 
 (* Function which get the nth element, put it in a file, let the user edit it,
 (* Function which get the nth element, put it in a file, let the user edit it,
  * and then remplace with the new result *)
  * and then remplace with the new result *)
@@ -90,22 +105,6 @@ let run ~(rc:File_com.t) position =
     let cmd_list = new_list shorter_list position new_commands in
     let cmd_list = new_list shorter_list position new_commands in
     let updated_rc = { rc with Settings_t.progs = cmd_list} in
     let updated_rc = { rc with Settings_t.progs = cmd_list} in
     File_com.write updated_rc;
     File_com.write updated_rc;
-    (* Concat edited item. messages should start as "".
-        * If only one element, return "elt".
-        * If more than one "\nelt1\nelt2\nelt3" 
-        * TODO Test it *)
-    let rec gen_modification items =
-        let r = "\n" in
-        epur items
-        |> (function
-            | [] -> ""
-            (* Only one element *)
-            | element :: [] -> element
-            (* The list as more than two elements *)
-            | _ ->
-                    let msg = String.concat ~sep:r items in
-                    String.concat [ r ; msg ; r ])
-    in
     (* Display the result *)
     (* Display the result *)
     sprintf "'%s' -> '%s'\n" original_command
     sprintf "'%s' -> '%s'\n" original_command
         (gen_modification new_commands)
         (gen_modification new_commands)

+ 1 - 1
src/oclaunch.ml

@@ -38,7 +38,7 @@ open Core.Std;;
 
 
 (* Variable to store version number *)
 (* Variable to store version number *)
 (* TODO Get value from file *)
 (* TODO Get value from file *)
-let version_number = "0.2.2-dev";;
+let version_number = "";;
 
 
 (* Variable store building information *)
 (* Variable store building information *)
 (* XXX This is fake value, it corresponds to the running
 (* XXX This is fake value, it corresponds to the running

+ 14 - 0
src/test/ec_t.ml

@@ -45,9 +45,23 @@ let epur () =
     OUnit.assert_equal current expected
     OUnit.assert_equal current expected
 ;;
 ;;
 
 
+(* Function gen_modification *)
+let gm1 () =
+    let current = Edit_command.gen_modification [ "qw" ] in
+    let expected = "qw" in
+    OUnit.assert_equal current expected
+;;
+let gm2 () =
+    let current = Edit_command.gen_modification [ "qw" ; "erty" ; "a" ; "zerty"] in
+    let expected = "\nqw\nerty\na\nzerty" in
+    OUnit.assert_equal current expected
+;;
+
 let n_l =
 let n_l =
     [
     [
         ("Remove empty strings in list",`Quick, epur);
         ("Remove empty strings in list",`Quick, epur);
+        ("Summary of modifications : one element",`Quick, gm1);
+        ("Summary of modifications : several elements",`Quick, gm2);
     ]
     ]
 ;;
 ;;