[Groonga-commit] groonga/groonga at 342f184 [master] string_substring: fix error message

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Jul 5 19:24:35 JST 2016


Kouhei Sutou	2016-07-05 19:24:35 +0900 (Tue, 05 Jul 2016)

  New Revision: 342f184307406cf7531ec1576251de64a9296533
  https://github.com/groonga/groonga/commit/342f184307406cf7531ec1576251de64a9296533

  Message:
    string_substring: fix error message

  Added files:
    test/command/suite/select/function/string/string_substring/missing_argument.expected
    test/command/suite/select/function/string/string_substring/missing_argument.test
  Modified files:
    plugins/functions/string.c

  Modified: plugins/functions/string.c (+1 -1)
===================================================================
--- plugins/functions/string.c    2016-07-05 19:23:06 +0900 (723e545)
+++ plugins/functions/string.c    2016-07-05 19:24:35 +0900 (8b50d0a)
@@ -94,7 +94,7 @@ func_string_substring(grn_ctx *ctx, int n_args, grn_obj **args,
 
   if (n_args < 2) {
     GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
-                     "string_substring(): wrong number of arguments (%d for 2..)",
+                     "string_substring(): wrong number of arguments (%d for 2..3)",
                      n_args);
     return NULL;
   }

  Added: test/command/suite/select/function/string/string_substring/missing_argument.expected (+42 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/string/string_substring/missing_argument.expected    2016-07-05 19:24:35 +0900 (380c6a5)
@@ -0,0 +1,42 @@
+plugin_register functions/string
+[[0,0.0,0.0],true]
+table_create Memos TABLE_HASH_KEY ShortText
+[[0,0.0,0.0],true]
+load --table Memos
+[
+{"_key": "Groonga"}
+]
+[[0,0.0,0.0],1]
+select Memos   --output_columns '_key, string_substring(_key)'
+[
+  [
+    [
+      -22,
+      0.0,
+      0.0
+    ],
+    "string_substring(): wrong number of arguments (1 for 2..3)"
+  ],
+  [
+    [
+      [
+        1
+      ],
+      [
+        [
+          "_key",
+          "ShortText"
+        ],
+        [
+          "string_substring",
+          null
+        ]
+      ],
+      [
+        "Groonga",
+        "string_substring(): wrong number of arguments (1 for 2..3)"
+      ]
+    ]
+  ]
+]
+#|e| string_substring(): wrong number of arguments (1 for 2..3)

  Added: test/command/suite/select/function/string/string_substring/missing_argument.test (+11 -0) 100644
===================================================================
--- /dev/null
+++ test/command/suite/select/function/string/string_substring/missing_argument.test    2016-07-05 19:24:35 +0900 (7bd8cb6)
@@ -0,0 +1,11 @@
+plugin_register functions/string
+
+table_create Memos TABLE_HASH_KEY ShortText
+
+load --table Memos
+[
+{"_key": "Groonga"}
+]
+
+select Memos \
+  --output_columns '_key, string_substring(_key)'
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index