src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/builtin_fn_fs_test.elvts (about)

     1  //////////////
     2  # tilde-abbr #
     3  //////////////
     4  
     5  //with-temp-home
     6  ~> tilde-abbr ~/foobar
     7  ▶ '~/foobar'
     8  
     9  //////
    10  # cd #
    11  //////
    12  
    13  //each:with-temp-home
    14  //each:in-temp-dir
    15  
    16  ## explicit argument ##
    17  ~> use os
    18     use path
    19     os:mkdir ~/d1
    20  ~> cd ~/d1
    21     eq $pwd (path:join ~ d1)
    22  ▶ $true
    23  
    24  ## changes to home with no argument ##
    25  ~> cd
    26  ~> eq $pwd ~
    27  ▶ $true
    28  
    29  ## arity check ##
    30  ~> cd dir1 dir2
    31  Exception: arity mismatch: arguments must be 0 to 1 values, but is 2 values
    32    [tty]:1:1-12: cd dir1 dir2
    33  
    34  ## GetHome error ##
    35  //mock-get-home-error can't get home
    36  ~> cd
    37  Exception: can't get home
    38    [tty]:1:1-2: cd