File: eval_test.elvts

package info (click to toggle)
elvish 0.21.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,372 kB
  • sloc: javascript: 236; sh: 130; python: 104; makefile: 88; xml: 9
file content (68 lines) | stat: -rw-r--r-- 1,146 bytes parent folder | download
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
//////////////////////////////////
# $before-chdir and $after-chdir #
//////////////////////////////////

//in-temp-dir

~> use os
   os:mkdir d
   var before-dst after-dst
   set @before-chdir = {|dst| set before-dst = $dst }
   set @after-chdir  = {|dst| set after-dst  = $dst }
   cd d
   put $before-dst $after-dst
▶ d
▶ d

////////
# $pid #
////////

~> > $pid 0
▶ $true

////////////////
# $num-bg-jobs #
////////////////

~> put $num-bg-jobs
▶ 0

// TODO(xiaq): Test cases where $num-bg-jobs > 0. This cannot be done with { put
// $num-bg-jobs }& because the output channel may have already been closed when
// the closure is run.

/////////
# $args #
/////////

~> put $args
▶ []

## non-empty ##
//args foo bar
~> put $args
▶ [foo bar]

////////////////////////
# multiple evaluations #
////////////////////////

~> var x = hello
~> put $x
▶ hello

## variable shadowing ##
// Regression test for b.elv.sh/1213
~> fn f { put old }
~> fn f { put new }
~> f
▶ new

## deleting variable ##
// Regression test for b.elv.sh/1213
~> var x = foo
~> del x
~> put $x
Compilation error: variable $x not found
  [tty]:1:5-6: put $x