-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.php
More file actions
77 lines (59 loc) · 1.63 KB
/
test.php
File metadata and controls
77 lines (59 loc) · 1.63 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
include 'functions.php';
$profilePath = __DIR__ . '/test_sample.sh';
//Get bash profile from home path;
$lines = file($profilePath);
# test commands
$tests = [];
$queryString = 'vg';
$tests[] = getBashCommands($lines, $queryString);
$queryString = 'ki';
$tests[] = getBashCommands($lines, $queryString);
$queryString = 'l';
$tests[] = getBashCommands($lines, $queryString);
$queryString = 'numFiles';
$tests[] = getBashCommands($lines, $queryString);
$queryString = 'ql ';
$tests[] = getBashCommands($lines, $queryString);
$queryString = 'ql ~/test.txt';
$tests[] = getBashCommands($lines, $queryString);
print_r($tests);
# test function getAllAlias
$testAlias = [
"alias ll='ls -alh'",
"alias less1='less -FSRXc' ",
" alias less2='less -FSRXc' ",
" alias less3='less -FSRXc' ",
" alias Less4='less -FSRXc' ",
" alias Less-5='less -FSRXc' ",
" alias Less_6='less -FSRXc' ",
" alias Less.7='less -FSRXc' ",
" invalid less3='less -FSRXc' ",
" aliasless3='less -FSRXc' ",
" alias='less -FSRXc' ",
];
$testFuncs = [
"trash () { command mv \"$@\" ~/.Trash ; } # trash: Moves a file to the MacOS trash",
"func(){ } #comment",
" func() # comment",
" func( ) ",
" function func() ",
"function func() ",
];
foreach ($testFuncs as $func) {
// print_r(getFunctionCmds($func, 'func')).PHP_EOL;
}
foreach ($testAlias as $line) {
// print_r(getAliasCmd($line, 'l')).PHP_EOL;
}
# test function getAllAlias
$testCmds = [
"fix_stty",
"numFiles",
"cd..",
"bash_profile_edit",
"bash-edit"
];
foreach ($testCmds as $cmd) {
// print_r(splitCamelCaseString($cmd)).PHP_EOL;
}