diff --git a/.gitignore b/.gitignore index 1a3b6110f..02db4d667 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ acconf.h acconf.h.in aclocal.m4 autom4te.cache +automation/aegisub-lua conf.sh config.log config.status diff --git a/automation/Makefile b/automation/Makefile index 955e2b1dd..d65ed375b 100644 --- a/automation/Makefile +++ b/automation/Makefile @@ -2,9 +2,7 @@ include ../Makefile.inc PRECOMPILED_HEADER_NAME = ../libaegisub/lagi_pre.h -LIB_SHARED = aegisub.so -LIB_VERSION = 0.1.0 -BUILD_LIB = no +PROGRAM = aegisub-lua CXXFLAGS += -I../libaegisub/include -I../src -I ../vendor/lua/src $(CXXFLAGS_WX) CPPFLAGS += $(CPPFLAGS_BOOST) @@ -15,8 +13,8 @@ LIBS += $(LIBS_WX) $(LIBS_BOOST) $(LIBS_ICU) SRC += tests/aegisub.cpp -test: $(LIB_SHARED) - moon tests/runner.moon +test: $(PROGRAM) + LUA=./aegisub-lua busted -p 'moon' tests/modules .PHONY: test @@ -58,3 +56,4 @@ install: install-share EXTRA_DIST = $(DATA_AUTOMATION) include ../Makefile.target +-include tests/*.d diff --git a/automation/tests/aegisub.cpp b/automation/tests/aegisub.cpp index e733978b7..7a1291122 100644 --- a/automation/tests/aegisub.cpp +++ b/automation/tests/aegisub.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2013, Thomas Goyne +// Copyright (c) 2014, Thomas Goyne // // Permission to use, copy, modify, and distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -15,8 +15,59 @@ // Aegisub Project http://www.aegisub.org/ #include +#include +#include -extern "C" int luaopen_aegisub(lua_State *L) { - agi::lua::preload_modules(L); - return 1; +#include +#include +#include +#include +#include + +using namespace agi::lua; + +namespace { +void check(lua_State *L, int status) { + if (status && !lua_isnil(L, -1)) { + fprintf(stderr, "%s\n", get_string_or_default(L, -1).c_str()); + exit(status); + } } +} + +int main(int argc, char **argv) { + if (argc < 2) { + fprintf(stderr, "usage: aegisub-lua