diff --git a/midori/sokoke.c b/midori/sokoke.c index 33381986..90019545 100644 --- a/midori/sokoke.c +++ b/midori/sokoke.c @@ -88,9 +88,9 @@ sokoke_magic_uri (const gchar* uri, { gchar* current_dir; gchar* result; + gchar** parts; gchar* search; const gchar* search_uri; - gchar** parts; KatzeItem* item; g_return_val_if_fail (uri, NULL); @@ -114,8 +114,17 @@ sokoke_magic_uri (const gchar* uri, if (!strstr (uri, "://")) { /* Do we have a domain, ip address or localhost? */ - if (strchr (uri, '.') != NULL || strchr (uri, ':') - || !strcmp (uri, "localhost")) + parts = g_strsplit (uri, ".", 0); + if (parts[0] && parts[1]) + { + search = NULL; + if (!(parts[1][1] == '\0' && !g_ascii_isalpha (parts[1][0]))) + search = g_strconcat ("http://", uri, NULL); + g_free (parts); + if (search) + return search; + } + if (strchr (uri, ':') || !strcmp (uri, "localhost")) return g_strconcat ("http://", uri, NULL); /* We don't want to search? So return early. */ if (!search_engines) diff --git a/wscript b/wscript index c6558f8a..45dcf493 100644 --- a/wscript +++ b/wscript @@ -7,6 +7,7 @@ import pproc as subprocess import Common import sys import os +import UnitTest APPNAME = 'midori' VERSION = '0.1.0' @@ -224,6 +225,9 @@ def build (bld): else: Params.pprint ('BLUE', "logo-shade could not be rasterized.") + if Params.g_commands['check']: + bld.add_subdirs ('tests') + def shutdown (): if Params.g_commands['install'] or Params.g_commands['uninstall']: dir = Common.path_install ('DATADIR', 'icons/hicolor') @@ -242,6 +246,14 @@ def shutdown (): Params.pprint ('YELLOW', "Icon cache not updated. After install, run this:") Params.pprint ('YELLOW', "gtk-update-icon-cache -q -f -t %s" % dir) + elif Params.g_commands['check']: + test = UnitTest.unit_test () + test.change_to_testfile_dir = True + test.want_to_see_test_output = True + test.want_to_see_test_error = True + test.run () + test.print_results () + elif Params.g_options.update_po: os.chdir('./po') try: