about summary refs log tree commit diff
path: root/Test/B07emulate.ztst
blob: 57eea3806d6380160c061c9c2d77004987dc5629 (plain) (blame)
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
# Test the "emulate" builtin and related functions.

%prep

  isset() { 
    if [[ -o $1 ]]; then print yes; else print no; fi
  }
  showopts() {
      # Set for Bourne shell emulation
      isset shwordsplit
      # Set in native mode and unless "emulate -R" is in use
      isset banghist
  }

%test

  (showopts
  fn() {
     emulate sh
  }
  fn
  showopts)
0:Basic use of emulate
>no
>yes
>yes
>yes

  fn() {
    emulate -L sh
    showopts
  }
  showopts
  fn
  showopts
0:Use of emulate -L
>no
>yes
>yes
>yes
>no
>yes

  (showopts
  emulate -R sh
  showopts)
0:Use of emulate -R
>no
>yes
>yes
>no

  showopts
  emulate sh -c 'showopts'
  showopts
0:Use of emulate -c
>no
>yes
>yes
>yes
>no
>yes


  showopts
  emulate -R sh -c 'showopts'
  showopts
0:Use of emulate -R -c
>no
>yes
>yes
>no
>no
>yes