"Fossies" - the Fresh Open Source Software Archive

Member "jed-0.99-19/src/test/test_expand.sl" (14 Dec 2009, 1784 Bytes) of package /linux/misc/jed-0.99-19.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 () = chdir ("/tmp");
    2 
    3 private variable Failed = 0;
    4 define test_expand_filename (a, b)
    5 {
    6    variable b1 = expand_filename (a);
    7    if (b != b1)
    8      {
    9 	Failed = 1;
   10 	message ("expand_filename ($a) -> $b1, expected $b"$);
   11      }
   12 }
   13 
   14 test_expand_filename ("", "/tmp/");
   15 test_expand_filename ("./", "/tmp/");
   16 test_expand_filename (".", "/tmp/");
   17 test_expand_filename ("..", "/");
   18 test_expand_filename ("../", "/");
   19 test_expand_filename (".././", "/");
   20 test_expand_filename ("foo.././", "/tmp/foo../");
   21 test_expand_filename ("f.././", "/tmp/f../");
   22 test_expand_filename ("fo.././", "/tmp/fo../");
   23 test_expand_filename ("fo.././bar", "/tmp/fo../bar");
   24 test_expand_filename ("././bar", "/tmp/bar");
   25 test_expand_filename ("/./bar", "/bar");
   26 test_expand_filename ("/./bar//gamma", "/gamma");
   27 test_expand_filename ("//./bar//gamma", "/bar/gamma");
   28 test_expand_filename ("//./bar//gamma/.", "/bar/gamma/");
   29 test_expand_filename ("//./bar//gamma/..", "/bar/");
   30 test_expand_filename ("/..", "/");
   31 test_expand_filename ("/.", "/");
   32 test_expand_filename ("~/foo", "$HOME/foo"$);
   33 test_expand_filename ("/foo/bar/~/xx/..", "$HOME/"$);
   34 test_expand_filename ("/foo/bar/~/~/xx/..", "$HOME/"$);
   35 test_expand_filename ("~/foo/bar/~/~/xx/..", "$HOME/"$);
   36 test_expand_filename ("~/foo/bar/~/~xx", "$HOME/~xx"$);
   37 test_expand_filename ("~/foo/bar/~/xx~", "$HOME/xx~"$);
   38 test_expand_filename ("~/foo/bar/~", "$HOME/foo/bar/~"$);
   39 
   40 #ifntrue
   41 % Only for __QNX__
   42 test_expand_filename ("/foo/bar///1/foo/bar", "//1/foo/bar");
   43 test_expand_filename ("//23", "//23");
   44 test_expand_filename ("//23/bar///1/foo/bar", "//1/foo/bar");
   45 test_expand_filename ("//23/bar///12/foo/bar", "//12/foo/bar");
   46 test_expand_filename ("//23/bar/~/baz", "$HOME/baz"$);
   47 #endif
   48 %test_expand_filename ("~dph/foo", "/home/dph");
   49 
   50   
   51 exit (Failed);