summaryrefslogtreecommitdiff
path: root/main/tests
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-02-10 14:54:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2019-02-10 15:11:32 +0100
commitc3638574267b0af5ca086b923e1c1777d1dd131d (patch)
tree12532cba87c1c1b1ff44c2452692bb85d108b364 /main/tests
parentf614f155063e43733c5e4c2572b4ea67b3bcc661 (diff)
Be explicit about usage of GDScript tests
Also drop empty "image" test, and print proper error when passing wrong test name. Fixes #25638.
Diffstat (limited to 'main/tests')
-rw-r--r--main/tests/test_gdscript.cpp5
-rw-r--r--main/tests/test_image.cpp69
-rw-r--r--main/tests/test_image.h45
-rw-r--r--main/tests/test_main.cpp8
4 files changed, 5 insertions, 122 deletions
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 60f9568fbd..27ff2addf3 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -911,11 +911,14 @@ MainLoop *test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
if (cmdlargs.empty()) {
- //try editor!
return NULL;
}
String test = cmdlargs.back()->get();
+ if (!test.ends_with(".gd") && !test.ends_with(".gdc")) {
+ print_line("This test expects a path to a GDScript file as its last parameter. Got: " + test);
+ return NULL;
+ }
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp
deleted file mode 100644
index ee4f43bae0..0000000000
--- a/main/tests/test_image.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*************************************************************************/
-/* test_image.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "test_image.h"
-
-#include "core/io/image_loader.h"
-#include "core/math/math_funcs.h"
-#include "core/os/main_loop.h"
-#include "core/print_string.h"
-
-namespace TestImage {
-
-class TestMainLoop : public MainLoop {
-
- bool quit;
-
-public:
- virtual void input_event(const Ref<InputEvent> &p_event) {
- }
-
- virtual void init() {
-
- quit = false;
- }
- virtual bool iteration(float p_time) {
-
- return quit;
- }
-
- virtual bool idle(float p_time) {
- return quit;
- }
-
- virtual void finish() {
- }
-};
-
-MainLoop *test() {
-
- return memnew(TestMainLoop);
-}
-} // namespace TestImage
diff --git a/main/tests/test_image.h b/main/tests/test_image.h
deleted file mode 100644
index b9b3c0cb48..0000000000
--- a/main/tests/test_image.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*************************************************************************/
-/* test_image.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef TEST_IMAGE_H
-#define TEST_IMAGE_H
-
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
-#include "core/os/main_loop.h"
-
-namespace TestImage {
-
-MainLoop *test();
-}
-
-#endif
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index 49f5cc5a18..22f1d7319f 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -36,7 +36,6 @@
#include "test_astar.h"
#include "test_gdscript.h"
#include "test_gui.h"
-#include "test_image.h"
#include "test_math.h"
#include "test_oa_hash_map.h"
#include "test_ordered_hash_map.h"
@@ -61,7 +60,6 @@ const char **tests_get_names() {
"gd_parser",
"gd_compiler",
"gd_bytecode",
- "image",
"ordered_hash_map",
"astar",
NULL
@@ -134,11 +132,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
return TestGDScript::test(TestGDScript::TEST_BYTECODE);
}
- if (p_test == "image") {
-
- return TestImage::test();
- }
-
if (p_test == "ordered_hash_map") {
return TestOrderedHashMap::test();
@@ -149,6 +142,7 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
return TestAStar::test();
}
+ print_line("Unknown test: " + p_test);
return NULL;
}