aboutsummaryrefslogtreecommitdiff
path: root/src/suites/misc.py
blob: a6b9bf2b0e0bdec27f493e11d1f75a686b1b3200 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# ############################################################################ #
#                                                                              #
#                                                         :::      ::::::::    #
#    misc.py                                            :+:      :+:    :+:    #
#                                                     +:+ +:+         +:+      #
#    By: cacharle <me@cacharle.xyz>                 +#+  +:+       +#+         #
#                                                 +#+#+#+#+#+   +#+            #
#    Created: 2020/10/10 13:06:19 by cacharle          #+#    #+#              #
#    Updated: 2020/11/28 06:10:12 by charles          ###   ########.fr        #
#                                                                              #
# ############################################################################ #

from suite import suite


@suite()
def suite_shlvl(test):
    """ test for the SHLVL variable """
    test("echo $SHLVL")
    test("echo $SHLVL", exports={"SHLVL": ""})
    test("echo $SHLVL", exports={"SHLVL": " 1"})
    test("echo $SHLVL", exports={"SHLVL": " 2"})
    test("echo $SHLVL", exports={"SHLVL": " 3"})
    test("echo $SHLVL", exports={"SHLVL": " ' 3'"})
    test("echo $SHLVL", exports={"SHLVL": " '\t3'"})
    test("echo $SHLVL", exports={"SHLVL": " '\t\f\r 3'"})
    test("echo $SHLVL", exports={"SHLVL": " '3 '"})
    test("echo $SHLVL", exports={"SHLVL": " '3\t'"})
    test("echo $SHLVL", exports={"SHLVL": " '3\r'"})
    test("echo $SHLVL", exports={"SHLVL": " '3\t\f\r '"})
    test("echo $SHLVL", exports={"SHLVL": " '3     a'"})
    test("echo $SHLVL", exports={"SHLVL": " '3\t\t\ta'"})
    test("echo $SHLVL", exports={"SHLVL": " 0"})
    test("echo $SHLVL", exports={"SHLVL": " -0"})
    test("echo $SHLVL", exports={"SHLVL": " -1"})
    test("echo $SHLVL", exports={"SHLVL": " 255"})
    test("echo $SHLVL", exports={"SHLVL": " 256"})
    test("echo $SHLVL", exports={"SHLVL": " 2000000"})
    test("echo $SHLVL", exports={"SHLVL": " -2000000"})
    test("echo $SHLVL", exports={"SHLVL": " 2147483647"})
    test("echo $SHLVL", exports={"SHLVL": " -2147483648"})
    test("echo $SHLVL", exports={"SHLVL": " 2147483648"})
    test("echo $SHLVL", exports={"SHLVL": " -2147483649"})
    test("echo $SHLVL", exports={"SHLVL": " 3147483648"})
    test("echo $SHLVL", exports={"SHLVL": " -3147483649"})
    test("echo $SHLVL", exports={"SHLVL": " 4294967295"})
    test("echo $SHLVL", exports={"SHLVL": " 4294967296"})
    test("echo $SHLVL", exports={"SHLVL": " -9223372036854775808"})
    test("echo $SHLVL", exports={"SHLVL": " 9223372036854775807"})
    test("echo $SHLVL", exports={"SHLVL": " -9223372036854775809"})
    test("echo $SHLVL", exports={"SHLVL": " 9223372036854775808"})
    test("echo $SHLVL", exports={"SHLVL": " 18446744073709551615"})
    test("echo $SHLVL", exports={"SHLVL": " 18446744073709551616"})
    test("echo $SHLVL", exports={"SHLVL": " +1"})
    test("echo $SHLVL", exports={"SHLVL": " +2"})
    test("echo $SHLVL", exports={"SHLVL": " +3"})
    test("echo $SHLVL", exports={"SHLVL": " +0"})
    test("echo $SHLVL", exports={"SHLVL": " +255"})
    test("echo $SHLVL", exports={"SHLVL": " +256"})
    test("echo $SHLVL", exports={"SHLVL": " +2000000"})
    test("echo $SHLVL", exports={"SHLVL": " +2147483647"})
    test("echo $SHLVL", exports={"SHLVL": " ++1"})
    test("echo $SHLVL", exports={"SHLVL": " ++2"})
    test("echo $SHLVL", exports={"SHLVL": " ++3"})
    test("echo $SHLVL", exports={"SHLVL": " ++0"})
    test("echo $SHLVL", exports={"SHLVL": " ++255"})
    test("echo $SHLVL", exports={"SHLVL": " ++256"})
    test("echo $SHLVL", exports={"SHLVL": " ++2000000"})
    test("echo $SHLVL", exports={"SHLVL": " ++2147483647"})
    test("echo $SHLVL", exports={"SHLVL": " --1"})
    test("echo $SHLVL", exports={"SHLVL": " --2"})
    test("echo $SHLVL", exports={"SHLVL": " --3"})
    test("echo $SHLVL", exports={"SHLVL": " --0"})
    test("echo $SHLVL", exports={"SHLVL": " --255"})
    test("echo $SHLVL", exports={"SHLVL": " --256"})
    test("echo $SHLVL", exports={"SHLVL": " --2000000"})
    test("echo $SHLVL", exports={"SHLVL": " --2147483647"})
    test("echo $SHLVL", exports={"SHLVL": " bonjour"})
    test("echo $SHLVL", exports={"SHLVL": " 0_"})
    test("echo $SHLVL", exports={"SHLVL": " _0"})
    test("echo $SHLVL", exports={"SHLVL": " 0123456789"})
    test("echo $SHLVL", exports={"SHLVL": " -0123456789"})
    test("echo $SHLVL", exports={"SHLVL": " 00000000000000000000000000000000000000000000001"})
    test("echo $SHLVL", exports={"SHLVL": " 00000000000000000000000000000000000000000000000"
         "00000000000000000000000000000000000000000000001"})


@suite()
def suite_lastcmd(test):
    """ test for $_, the last executed command """
    test("echo $_")
    test("echo; echo $_")
    test("env; echo $_")
    test("export A=a; echo $_")
    test("unset A; echo $_")
    test("echo a b c d; echo $_")
    test("cat -e /etc/shells; echo $_")
    test("echo a; echo \"$_\"")
    test("echo a; echo '$_'")
    test("echo a; echo \"@$_@\"")