mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-12 17:27:50 +08:00
69 lines
1.1 KiB
Plaintext
69 lines
1.1 KiB
Plaintext
//////////////////////////////////
|
|
# $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
|