Basic tests
This commit is contained in:
parent
7db446dd8d
commit
0f48bbe5c8
17618
tests/catch.hpp
Normal file
17618
tests/catch.hpp
Normal file
File diff suppressed because it is too large
Load Diff
22
tests/test.cpp
Normal file
22
tests/test.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
#include "../functions.hpp"
|
||||
#include <stdlib.h>
|
||||
|
||||
TEST_CASE( "urlencode" ) {
|
||||
std::string url1 = "http://google.com";
|
||||
std::string url1_expected = "http%3A%2F%2Fgoogle.com";
|
||||
REQUIRE( encodeUrl( url1 ) == url1_expected );
|
||||
std::string url2 = "https://www.google.com/search?q=日本語";
|
||||
std::string url2_expected = "https%3A%2F%2Fwww.google.com%2Fsearch%3F"
|
||||
"q%3D%E6%97%A5%E6%9C%AC%E8%AA%9E";
|
||||
REQUIRE( encodeUrl( url2 ) == url2_expected );
|
||||
}
|
||||
|
||||
TEST_CASE( "userHome" ) {
|
||||
auto home = userHome();
|
||||
std::string command = "/bin/bash -c \"if [ \"${HOME}\" == \"";
|
||||
command += home;
|
||||
command += "\" ] ; then exit 0 ; else exit 1 ; fi\"";
|
||||
REQUIRE( system( command.c_str() ) == 0 );
|
||||
}
|
Loading…
Reference in New Issue
Block a user