Lolly 1.4.27
Loading...
Searching...
No Matches
Functions
subprocess_test.cpp File Reference
#include "a_lolly_test.hpp"
#include "lolly/system/subprocess.hpp"
#include "sys_utils.hpp"
Include dependency graph for subprocess_test.cpp:

Go to the source code of this file.

Functions

TEST_MEMORY_LEAK_INIT TEST_CASE ("check_output")
 
 TEST_CASE ("call")
 

Function Documentation

◆ TEST_CASE() [1/2]

TEST_MEMORY_LEAK_INIT TEST_CASE ( "check_output" )

Definition at line 21 of file subprocess_test.cpp.

21 {
22 string stdout_result;
23 string stderr_result;
24 if (!os_wasm () && !os_mingw ()) {
25 lolly::system::check_stdout ("xmake --version", stdout_result);
26 CHECK (N (stdout_result) > 0);
27 lolly::system::check_stderr ("ls /no_such_dir", stderr_result);
28 CHECK (N (stderr_result) > 0);
29 }
30}
int N(array< T > a)
Get the length of the array.
Definition array.hpp:170
The list class represents a linked list.
Definition list.hpp:48
int check_stderr(string cmd, string &result)
int check_stdout(string cmd, string &result)
bool os_mingw()
bool os_wasm()

◆ TEST_CASE() [2/2]

TEST_CASE ( "call" )

Definition at line 32 of file subprocess_test.cpp.

32 {
33#ifdef OS_WASM
34 CHECK_EQ (call ("xmake --version"), -1);
35 CHECK_EQ (call ("no_such_command"), -1);
36 CHECK_EQ (call (""), -1);
37#else
38#ifndef OS_MINGW
39 CHECK (call ("xmake --version") == 0);
40#endif
41 CHECK (call ("no_such_command") != 0);
42 CHECK (call ("") != 0);
43#endif
44}