Displaying 20 results from an estimated 23 matches for "test_string_lines_split".
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...sert_equal_int 0 (string_find "foo" "");
assert_equal_int 1 (string_find "foo" "o");
@@ -112,7 +112,7 @@ let test_string_find () =
assert_equal_int (-1) (string_find "foobar" "baz")
(* Test Common_utils.string_lines_split. *)
-let test_string_lines_split () =
+let test_string_lines_split ctx =
assert_equal_stringlist [""] (string_lines_split "");
assert_equal_stringlist ["A"] (string_lines_split "A");
assert_equal_stringlist ["A"; ""] (string_lines_split "A\n");
@@ -129,...
2017 Jan 30
0
[PATCH v6 2/3] mllib: modify nsplit to take optional noempty and count arguments
...unt:10 "|" "A|B|C|D");
+
+ (* count and keep_empty together *)
+ assert_equal_stringlist ["A"; "B"; "|||C|D"] (String.nsplit ~keep_empty:false ~count:2 "|" "|||A||||B||||C|D")
+
(* Test Common_utils.String.lines_split. *)
let test_string_lines_split ctx =
assert_equal_stringlist [""] (String.lines_split "");
@@ -135,6 +164,7 @@ let suite =
"strings.is_prefix" >:: test_string_is_prefix;
"strings.is_suffix" >:: test_string_is_suffix;
"strings.find" >:: test_string...
2017 Apr 07
1
[PATCH 1/2] mllib: add new Common_utils.run_commands
...ot;)
+let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")")
let test_subdirectory ctx =
assert_equal_string "" (subdirectory "/foo" "/foo");
@@ -131,6 +132,54 @@ let test_string_lines_split ctx =
assert_equal_stringlist ["A\nB"; ""] (String.lines_split "A\\\nB\n");
assert_equal_stringlist ["A\nB\n"] (String.lines_split "A\\\nB\\\n")
+(* Test Common_utils.run_commands. *)
+let test_run_commands ctx =
+ begin
+ let res = run_...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
...le32 and Common_utils.le32_of_int. *)
let test_le32 () =
@@ -110,6 +111,22 @@ let test_string_find () =
assert_equal_int (-1) (string_find "" "baz");
assert_equal_int (-1) (string_find "foobar" "baz")
+(* Test Common_utils.string_lines_split. *)
+let test_string_lines_split () =
+ assert_equal_stringlist [""] (string_lines_split "");
+ assert_equal_stringlist ["A"] (string_lines_split "A");
+ assert_equal_stringlist ["A"; ""] (string_lines_split "A\n");
+ assert_equal_stringlist ["A";...
2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...ot;)
+let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^ (String.concat ";" (List.map string_of_int x)) ^ ")")
let test_subdirectory ctx =
assert_equal_string "" (subdirectory "/foo" "/foo");
@@ -131,6 +132,73 @@ let test_string_lines_split ctx =
assert_equal_stringlist ["A\nB"; ""] (String.lines_split "A\\\nB\n");
assert_equal_stringlist ["A\nB\n"] (String.lines_split "A\\\nB\\\n")
+(* Test Common_utils.run_command. *)
+let test_run_command ctx =
+ assert_equal_int 0 (run_com...
2016 Dec 18
0
[PATCH v4 4/6] mllib: modify nsplit to take optional noempty and count arguments
...nsplit ~count:10 "," "A,B,C,D");
+
+ (* count and noempty together *)
+ assert_equal_stringlist ["A"; "B"; "C,D"] (String.nsplit ~noempty:true ~count:2 "," ",,,A,,,,B,,,,C,D")
+
(* Test Common_utils.String.lines_split. *)
let test_string_lines_split ctx =
assert_equal_stringlist [""] (String.lines_split "");
--
2.10.2
2019 Jan 11
3
[PATCH 1/3] mlstdutils: add a very simple test for Std_utils.which
...assert_nonempty_string (which "true");
+ assert_raises_executable_not_found "this-command-does-not-really-exist";
+ ()
+
(* Suites declaration. *)
let suite =
"mllib Std_utils" >:::
@@ -154,6 +165,7 @@ let suite =
"strings.lines_split" >:: test_string_lines_split;
"strings.span" >:: test_string_span;
"strings.chomp" >:: test_string_chomp;
+ "which" >:: test_which;
]
let () =
--
2.17.2
2017 Jul 21
3
[PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.
..._equal_string "\n" (String.chomp "\n\n") (* only removes one *)
+
(* Suites declaration. *)
let suite =
"mllib Std_utils" >:::
@@ -122,6 +131,7 @@ let suite =
"strings.find" >:: test_string_find;
"strings.lines_split" >:: test_string_lines_split;
"strings.span" >:: test_string_span;
+ "strings.chomp" >:: test_string_chomp;
]
let () =
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 73c6e2473..597128967 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -376,14 +37...
2017 Jan 11
3
[PATCH v5 0/3] Import directly from OVA tar archive if possible
v5:
- rebase, patches 1,3,5 were merged
- 1/3: we still need to discuss whether to detect compressed discs
- 2/3:
- renamed argument noempty to keep_empty
- tests were not run
- 3/3:
- using JSON module to generate JSON (as suggested by Pino)
- all the other comments raised by Pino
v4:
- rebase to more recent master
- 1/6: using just "quote" instead of
2017 Feb 03
3
[PATCH v7 0/1] Import directly from OVA tar archive if possible
v7:
- rebased because patch 1/3 has been pushed
- changes to nsplit have been dropped (2/3)
- addressed Richard's comments, notably the subfolder function was moved to
mllib and renamed to subdirectory
v6:
- just rebase
v5:
- rebase, patches 1,3,5 were merged
- 1/3: we still need to discuss whether to detect compressed discs
- 2/3:
- renamed argument noempty to keep_empty
- tests were
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...ind "foo" "o");
+ assert_equal_int 3 (String.find "foobar" "bar");
+ assert_equal_int (-1) (String.find "" "baz");
+ assert_equal_int (-1) (String.find "foobar" "baz")
+
+(* Test Std_utils.String.lines_split. *)
+let test_string_lines_split ctx =
+ assert_equal_stringlist [""] (String.lines_split "");
+ assert_equal_stringlist ["A"] (String.lines_split "A");
+ assert_equal_stringlist ["A"; ""] (String.lines_split "A\n");
+ assert_equal_stringlist ["A";...
2017 Feb 03
0
[PATCH v7 1/1] v2v: ova: don't extract files from OVA if it's not needed
...quot;);
+ assert_equal_string "bar/baz" (subdirectory "/foo" "/foo/bar/baz")
+
(* Test Common_utils.int_of_le32 and Common_utils.le32_of_int. *)
let test_le32 ctx =
assert_equal_int64 0x20406080L (int_of_le32 "\x80\x60\x40\x20");
@@ -129,6 +135,7 @@ let test_string_lines_split ctx =
let suite =
"mllib Common_utils" >:::
[
+ "subdirectory" >:: test_subdirectory;
"numeric.le32" >:: test_le32;
"sizes.parse_resize" >:: test_parse_resize;
"sizes.human_size" >:: test_human_size;...
2017 Sep 22
27
[PATCH v3 00/22] Replace almost all uses of the Str module with PCRE.
v1:
https://www.redhat.com/archives/libguestfs/2017-September/msg00135.html
v2:
https://www.redhat.com/archives/libguestfs/2017-September/msg00158.html
v3 is almost identical to v2, but I have added 4 extra commits to
almost finish the job of replacing Str everywhere possible (note it's
not possible to replace Str in common/mlstdutils or the generator
because those are pure OCaml).
As
2017 Jan 30
6
[PATCH v6 0/3] Import directly from OVA tar archive if possible
v6:
- just rebase
v5:
- rebase, patches 1,3,5 were merged
- 1/3: we still need to discuss whether to detect compressed discs
- 2/3:
- renamed argument noempty to keep_empty
- tests were not run
- 3/3:
- using JSON module to generate JSON (as suggested by Pino)
- all the other comments raised by Pino
v4:
- rebase to more recent master
- 1/6: using just "quote" instead of
2017 Jun 19
16
[PATCH v7 00/13] Refactor utilities
This is just the utilities part of the patch series from:
https://www.redhat.com/archives/libguestfs/2017-June/msg00103.html
I believe this addresses everything raised in comments on that
patch series.
Rich.
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...- "strings.suffix" >:: test_string_suffix;
+ "strings.prefix" >:: test_String.is_prefix;
+ "strings.suffix" >:: test_String.is_suffix;
"strings.find" >:: test_string_find;
"strings.string_lines_split" >:: test_string_lines_split;
]
diff --git a/sparsify/copying.ml b/sparsify/copying.ml
index 80d7c9d..ef196f6 100644
--- a/sparsify/copying.ml
+++ b/sparsify/copying.ml
@@ -75,7 +75,7 @@ let run indisk outdisk check_tmpdir compress convert
| None -> Directory Filename.temp_dir_name (* $TMPDIR or /tmp *)
| Som...
2016 Dec 18
9
[PATCH v4 0/6] Import directly from OVA tar archive if possible
v4:
- rebase to more recent master
- 1/6: using just "quote" instead of "Filename.quote"
- 2/6: reformated block of code according to Richards suggestion
- 4/6: added tests for nsplit
v3: Addressed Pino's comments, namely:
- input_ova.ml
- untar takes list of paths
- renamed untar_partial to untar_metadata
- replaced uggly regex with nsplit
- tests
- test changes
2017 Feb 04
8
[PATCH v8 0/4] Import directly from OVA tar archive if possible
v8:
- split the big patch into several commits
v7:
- rebased because patch 1/3 has been pushed
- changes to nsplit have been dropped (2/3)
- addressed Richard's comments, notably the subfolder function was moved to
mllib and renamed to subdirectory
v6:
- just rebase
v5:
- rebase, patches 1,3,5 were merged
- 1/3: we still need to discuss whether to detect compressed discs
- 2/3:
-
2015 Oct 06
10
[PATCH 0/5] mllib: Hide bad String functions and miscellaneous refactoring.
Hide/prevent the use of bad string functions like String.lowercase.
These are replaced by safe functions that won't break UTF-8 strings.
Other miscellaneous refactoring.
Rich.
2017 Jun 09
12
[PATCH 00/12] Refactor utility functions.
This turned out to be rather more involved than I thought.
We have lots of utility functions, spread all over the repository,
with not a lot of structure. This moves many of them under common/
and structures them so there are clear dependencies.
This doesn't complete the job by any means. Other items I had on my
to-do list for this change were:
- Split up mllib/common_utils into:
-