Displaying 20 results from an estimated 21 matches for "test_string_find".
2015 May 11
3
[PATCH 1/2] mllib: Require OUnit2 for tests.
...quot;);
assert_bool "string_suffix,foo,foo" (string_suffix "foo" "foo");
@@ -103,7 +103,7 @@ let test_string_suffix () =
assert_bool "not string_suffix,,foo" (not (string_suffix "" "foo"))
(* Test Common_utils.string_find. *)
-let test_string_find () =
+let test_string_find ctx =
assert_equal_int 0 (string_find "" "");
assert_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)...
2017 Jan 30
0
[PATCH v6 2/3] mllib: modify nsplit to take optional noempty and count arguments
...t the first occurrence of the
separator [sep], returning the part before and the part after.
diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml
index 77b0524c1..e30179323 100644
--- a/mllib/common_utils_tests.ml
+++ b/mllib/common_utils_tests.ml
@@ -109,6 +109,35 @@ let test_string_find ctx =
assert_equal_int (-1) (String.find "" "baz");
assert_equal_int (-1) (String.find "foobar" "baz")
+(* Test Common_utils.String.nsplit *)
+let test_string_nsplit ctx =
+ (* Basic functionality *)
+ assert_equal_stringlist [""] (String....
2015 Jan 22
3
[PATCH 1/2] configure: look for the oUnit OCaml module
It will be used for the OCaml unit tests.
---
configure.ac | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/configure.ac b/configure.ac
index e0fb481..e360bbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1120,6 +1120,7 @@ AS_IF([test "x$OCAMLC" != "xno"],[
])
OCAML_PKG_gettext=no
+OCAML_PKG_oUnit=no
AS_IF([test "x$OCAMLC" != "xno"],[
#
2015 Jan 22
0
[PATCH 2/2] mllib: convert common_utils_tests to oUnit
...(string_suffix "foo" "foo");
+ assert_bool "string_suffix,123foo,foo" (string_suffix "123foo" "foo");
+ assert_bool "not string_suffix,,foo" (not (string_suffix "" "foo"))
+
+(* Test Common_utils.string_find. *)
+let test_string_find () =
+ assert_equal_int 0 (string_find "" "");
+ assert_equal_int 0 (string_find "foo" "");
+ assert_equal_int 1 (string_find "foo" "o");
+ assert_equal_int 3 (string_find "foobar" "bar");
+ assert_equal_int (-1) (...
2015 Jan 23
2
[PATCH 1/2] mllib: tests: add tests for string_lines_split
...inter:(fun x -> Int64.to_string x)
+let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")")
(* Test Common_utils.int_of_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 "&q...
2016 Dec 18
0
[PATCH v4 4/6] mllib: modify nsplit to take optional noempty and count arguments
...r] at the first occurrence of the
separator [sep], returning the part before and the part after.
diff --git a/mllib/common_utils_tests.ml b/mllib/common_utils_tests.ml
index ee27b93..ef5665f 100644
--- a/mllib/common_utils_tests.ml
+++ b/mllib/common_utils_tests.ml
@@ -109,6 +109,32 @@ let test_string_find ctx =
assert_equal_int (-1) (String.find "" "baz");
assert_equal_int (-1) (String.find "foobar" "baz")
+(* Test Common_utils.String.nsplit *)
+let test_string_nsplit ctx =
+ (* Basic functionality *)
+ assert_equal_stringlist [""] (String....
2017 Jul 21
3
[PATCH] common/mlstdutils: Add chomp function to remove \n from end of strings.
...ual_string "" (String.chomp "\n");
+ assert_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...
2017 Apr 07
1
[PATCH 1/2] mllib: add new Common_utils.run_commands
...n
+ assert_equal_string "this is a test\n" content
+ end;
+ ()
+
(* Suites declaration. *)
let suite =
"mllib Common_utils" >:::
@@ -143,6 +192,7 @@ let suite =
"strings.is_suffix" >:: test_string_is_suffix;
"strings.find" >:: test_string_find;
"strings.lines_split" >:: test_string_lines_split;
+ "run_commands" >:: test_run_commands;
]
let () =
--
2.9.3
2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...n
+ assert_equal_string "this is a test\n" content
+ end;
+ ()
+
(* Suites declaration. *)
let suite =
"mllib Common_utils" >:::
@@ -143,6 +211,8 @@ let suite =
"strings.is_suffix" >:: test_string_is_suffix;
"strings.find" >:: test_string_find;
"strings.lines_split" >:: test_string_lines_split;
+ "run_command" >:: test_run_command;
+ "run_commands" >:: test_run_commands;
]
let () =
--
2.9.4
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
2015 Oct 06
0
[PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
...fix "foo" "foo");
+ assert_bool "String.is_suffix,123foo,foo" (String.is_suffix "123foo" "foo");
+ assert_bool "not String.is_suffix,,foo" (not (String.is_suffix "" "foo"))
(* Test Common_utils.string_find. *)
let test_string_find ctx =
@@ -132,8 +132,8 @@ let suite =
"numeric.le32" >:: test_le32;
"sizes.parse_resize" >:: test_parse_resize;
"sizes.human_size" >:: test_human_size;
- "strings.prefix" >:: test_string_prefix;
- "strings.suffi...
2017 Jun 15
0
[PATCH v6 04/41] mllib: Split ‘Common_utils’ into ‘Std_utils’ + ‘Common_utils’.
...suffix "foo" "foo");
+ assert_bool "String.is_suffix,123foo,foo" (String.is_suffix "123foo" "foo");
+ assert_bool "not String.is_suffix,,foo" (not (String.is_suffix "" "foo"))
+
+(* Test Std_utils.String.find. *)
+let test_string_find ctx =
+ assert_equal_int 0 (String.find "" "");
+ assert_equal_int 0 (String.find "foo" "");
+ assert_equal_int 1 (String.find "foo" "o");
+ assert_equal_int 3 (String.find "foobar" "bar");
+ assert_equal_int (-1)...
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 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.
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 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:
-
2017 Jun 12
32
[PATCH v5 00/32] Refactor utilities, implement some APIs in OCaml.
This is a combination of:
https://www.redhat.com/archives/libguestfs/2017-June/msg00046.html
[PATCH 00/12] Refactor utility functions.
plus:
https://www.redhat.com/archives/libguestfs/2017-June/msg00023.html
[PATCH v3 00/19] Allow APIs to be implemented in OCaml.
with the second patches rebased on top of the utility refactoring, and
some other adjustments and extensions.
This passes
2017 Jun 15
45
[PATCH v6 00/41] Refactor utilities, reimplement inspection in the daemon.
v5:
https://www.redhat.com/archives/libguestfs/2017-June/msg00065.html
Since v5, this now implements inspection almost completely for Linux
and Windows guests.
Rich.