G_CALLBACK (addons_deactivate_cb), app);
}
+#ifdef G_ENABLE_DEBUG
+static void
+test_addons_simple_regexp (void)
+{
+ typedef struct
+ {
+ const gchar* before;
+ const gchar* after;
+ } RegexItem;
+ guint i;
+
+ static const RegexItem items[] = {
+ { "*", "^.*" },
+ { "http://", "^http://" },
+ { "https://", "^https://" },
+ { "about:blank", "^about:blank" },
+ { "file://", "^file://" },
+ { "ftp://", "^ftp://" },
+ { "https://bugzilla.mozilla.org/", "^https://bugzilla\\.mozilla\\.org/" },
+ { "http://92.48.103.52/fantasy3/*", "^http://92\\.48\\.103\\.52/fantasy3/.*" },
+ { "http://www.rpg.co.uk/fantasy/*", "^http://www\\.rpg\\.co\\.uk/fantasy/.*" },
+ { "http://cookpad.com/recipe/*", "^http://cookpad\\.com/recipe/.*" },
+ { "https://*/*post_bug.cgi", "^https://.*/.*post_bug\\.cgi" },
+ };
+
+ for (i = 0; i < G_N_ELEMENTS (items); i++)
+ {
+ gchar* result = addons_convert_to_simple_regexp (items[i].before);
+ const gchar* after = items[i].after ? items[i].after : items[i].before;
+ katze_assert_str_equal (items[i].before, result, after);
+ g_free (result);
+ }
+}
+
+void
+extension_test (void)
+{
+ g_test_add_func ("/extensions/addons/simple_regexp", test_addons_simple_regexp);
+}
+#endif
+
MidoriExtension*
extension_init (void)
{
return entry;
}
+/**
+ * katze_assert_str_equal:
+ * @input: a string
+ * @result: a string
+ * @expected: a string
+ *
+ * Compares the two strings for equality, with verbose errors.
+ *
+ * Since: 0.4.3
+ */
+void
+katze_assert_str_equal (const gchar* input,
+ const gchar* result,
+ const gchar* expected)
+{
+ if (g_strcmp0 (result, expected))
+ {
+ g_error ("Input: %s\nExpected: %s\nResult: %s",
+ input ? input : "NULL",
+ expected ? expected : "NULL",
+ result ? result : "NULL");
+ }
+}
+
GtkWidget*
katze_uri_entry_new (GtkWidget* other_widget);
+void
+katze_assert_str_equal (const gchar* input,
+ const gchar* result,
+ const gchar* expected);
+
G_END_DECLS
#endif /* __KATZE_UTILS_H__ */
#define SM "http://www.searchmash.com/search/"
-static void
-sokoke_assert_str_equal (const gchar* input,
- const gchar* result,
- const gchar* expected)
-{
- if (g_strcmp0 (result, expected))
- {
- g_error ("Input: %s\nExpected: %s\nResult: %s",
- input ? input : "NULL",
- expected ? expected : "NULL",
- result ? result : "NULL");
- }
-}
-
static void
test_input (const gchar* input,
const gchar* expected)
g_free (keywords);
}
- sokoke_assert_str_equal (input, uri, expected);
+ katze_assert_str_equal (input, uri, expected);
g_free (uri);
}
{
gchar* result = midori_uri_to_ascii (items[i].before);
const gchar* after = items[i].after ? items[i].after : items[i].before;
- sokoke_assert_str_equal (items[i].before, result, after);
+ katze_assert_str_equal (items[i].before, result, after);
g_free (result);
}
{
gchar* result = midori_uri_format_for_display (items[i].before);
const gchar* after = items[i].after ? items[i].after : items[i].before;
- sokoke_assert_str_equal (items[i].before, result, after);
+ katze_assert_str_equal (items[i].before, result, after);
g_free (result);
}
}