aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/OptionGroup.java
Commit message (Expand)AuthorAgeFilesLines
* Update copyright year to 2014Artur Signell2014-04-161-1/+1
* Updated copyright notices and added missing license headersArtur Signell2013-01-041-2/+2
* Unified deprecation messagesArtur Signell2012-11-221-4/+4
* Reformat projectLeif Åstrand2012-09-051-0/+4
* refak listeners com.vaadin.uiPetri Heinonen2012-08-301-4/+39
* Renamed com.vaadin.terminal -> com.vaadin.server (#9431)Artur Signell2012-08-291-2/+2
* Rename requestRepaint to markAsDirty (#9378)Leif Åstrand2012-08-231-5/+5
* Replaced license place holder with actual license (#8955)Artur Signell2012-08-161-1/+13
* Eliminated dependencies from server to client (#9279)Artur Signell2012-08-131-3/+4
* Moved server files to a server src folder (#9299)Artur Signell2012-08-131-0/+203
{ color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/* Copyright (c) 2015, Vsevolod Stakhov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *       * Redistributions of source code must retain the above copyright
 *         notice, this list of conditions and the following disclaimer.
 *       * Redistributions in binary form must reproduce the above copyright
 *         notice, this list of conditions and the following disclaimer in the
 *         documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL AUTHOR BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "config.h"
#include "rspamd.h"
#include "util.h"
#include "lua/lua_common.h"
#include "unix-std.h"

#ifdef HAVE_GLOB_H
#include <glob.h>
#endif

static const char *lua_src = BUILDROOT "/test/lua/tests.lua";

static int
traceback (lua_State *L)
{
	if (!lua_isstring (L, 1)) {
		return 1;
	}

	lua_getglobal (L, "debug");

	if (!lua_istable(L, -1)) {
		lua_pop(L, 1);
		return 1;
	}

	lua_getfield (L, -1, "traceback");

	if (!lua_isfunction(L, -1)) {
		lua_pop(L, 2);
		return 1;
	}
	lua_pushvalue (L, 1);
	lua_pushinteger (L, 2);
	lua_call(L, 2, 1);

	return 1;
}

void
rspamd_lua_test_func (void)
{
	lua_State *L = rspamd_lua_init ();
	gchar *rp, rp_buf[PATH_MAX], path_buf[PATH_MAX], *tmp, *dir, *pattern;
	const gchar *old_path;
	glob_t globbuf;
	gint i, len;

	rspamd_printf ("Starting lua tests\n");

	if ((rp = realpath (lua_src, rp_buf)) == NULL) {
		msg_err ("cannot find path %s: %s",
				lua_src, strerror (errno));
		g_assert (0);
	}

	tmp = g_strdup (rp);
	dir = dirname (tmp);
	/* Set lua path */
	lua_getglobal (L, "package");
	lua_getfield (L, -1, "path");
	old_path = luaL_checkstring (L, -1);

	rspamd_snprintf (path_buf, sizeof (path_buf), "%s;%s/?.lua;%s/unit/?.lua",
			old_path, dir, dir);
	lua_pop (L, 1);
	lua_pushstring (L, path_buf);
	lua_setfield (L, -2, "path");
	lua_pop (L, 1);

	lua_newtable (L);

	globbuf.gl_offs = 0;
	len = strlen (dir) + sizeof ("/unit/") + sizeof ("*.lua");
	pattern = g_malloc (len);
	rspamd_snprintf (pattern, len, "%s/unit/%s", dir, "*.lua");

	if (glob (pattern, GLOB_DOOFFS, NULL, &globbuf) == 0) {
		for (i = 0; i < (gint)globbuf.gl_pathc; i++) {
			lua_pushinteger (L, i + 1);
			lua_pushstring (L, globbuf.gl_pathv[i]);
			lua_settable (L, -3);
		}
		globfree (&globbuf);
		g_free (pattern);
	}
	else {
		msg_err ("pattern %s doesn't match: %s", pattern,
				strerror (errno));
		g_assert (0);
	}

	lua_setglobal (L, "tests_list");

	lua_pushcfunction (L, traceback);
	luaL_loadfile (L, rp);

	if (lua_pcall (L, 0, 0, lua_gettop (L) - 1) != 0) {
		msg_err ("run test failed: %s", lua_tostring (L, -1));
		g_assert (0);
	}

	exit (EXIT_SUCCESS);
}