Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/tests/fn_getcwd_tests.cpp')
-rw-r--r--src/engine/tests/fn_getcwd_tests.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/engine/tests/fn_getcwd_tests.cpp b/src/engine/tests/fn_getcwd_tests.cpp
new file mode 100644
index 0000000..ef223c8
--- /dev/null
+++ b/src/engine/tests/fn_getcwd_tests.cpp
@@ -0,0 +1,46 @@
+/**
+ * \file fn_getcwd_tests.cpp
+ * \brief Automated test for the getcwd() function.
+ * \author Copyright (c) 2007-2008 Jason Perkins and the Premake project
+ */
+
+#include "premake.h"
+#include "testing/testing.h"
+extern "C" {
+#include "engine/session.h"
+#include "base/cstr.h"
+}
+
+
+struct FnGetCwd
+{
+ Session sess;
+
+ FnGetCwd()
+ {
+ sess = session_create();
+ }
+
+ ~FnGetCwd()
+ {
+ session_destroy(sess);
+ }
+};
+
+
+SUITE(engine)
+{
+ TEST_FIXTURE(FnGetCwd, GetCwd_Exists_OnStartup)
+ {
+ const char* result = session_run_string(sess,
+ "return (os.getcwd ~= nil)");
+ CHECK_EQUAL("true", result);
+ }
+
+ TEST_FIXTURE(FnGetCwd, GetCwd_ReturnsCwd)
+ {
+ const char* result = session_run_string(sess,
+ "return os.getcwd()");
+ CHECK(cstr_ends_with(result, "/src"));
+ }
+}