File: should_wait_for_program.c

package info (click to toggle)
vifm 0.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,252 kB
  • sloc: ansic: 179,567; sh: 5,445; makefile: 723; perl: 347; python: 76; xml: 26
file content (46 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stic.h>

#include "../../src/utils/fs.h"
#include "../../src/utils/utils.h"

#ifdef _WIN32

static int cmd_exists(void);
static int mspaint_exists(void);

TEST(console_program_is_detected, IF(cmd_exists))
{
	assert_true(should_wait_for_program("c:/windows/system32/cmd.exe"));
}

TEST(graphical_program_is_detected, IF(mspaint_exists))
{
	assert_false(should_wait_for_program("c:/windows/system32/mspaint.exe"));
}

TEST(backslashes_do_not_affect_outcome_console, IF(cmd_exists))
{
	assert_true(should_wait_for_program("c:\\windows\\system32\\cmd.exe"));
}

TEST(backslashes_do_not_affect_outcome_graphical, IF(mspaint_exists))
{
	assert_false(should_wait_for_program("c:\\windows\\system32\\mspaint.exe"));
}

static int
cmd_exists(void)
{
	return path_exists("c:/windows/system32/cmd.exe", DEREF);
}

static int
mspaint_exists(void)
{
	return path_exists("c:/windows/system32/mspaint.exe", DEREF);
}

#endif

/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */
/* vim: set cinoptions+=t0 filetype=c : */