[Pkg-jed-commit] r990 - jed-extra/trunk/tests

Guenter Milde milde-guest at alioth.debian.org
Fri Dec 7 14:58:11 UTC 2007


Author: milde-guest
Date: 2007-12-07 14:58:11 +0000 (Fri, 07 Dec 2007)
New Revision: 990

Removed:
   jed-extra/trunk/tests/ch_table-test.sl
   jed-extra/trunk/tests/csvutils-test.sl
   jed-extra/trunk/tests/cuamark-test.sl
   jed-extra/trunk/tests/cuamouse-test.sl
   jed-extra/trunk/tests/datutils-test.sl
   jed-extra/trunk/tests/ishell-test.sl
   jed-extra/trunk/tests/listing-test.sl
   jed-extra/trunk/tests/pymode-test.sl
   jed-extra/trunk/tests/rst-test.sl
   jed-extra/trunk/tests/structured_text-test.sl
   jed-extra/trunk/tests/test-browse_url.sl
   jed-extra/trunk/tests/test-calc.sl
   jed-extra/trunk/tests/test-console_keys.sl
   jed-extra/trunk/tests/test-css1.sl
   jed-extra/trunk/tests/test-dict-cli.sl
   jed-extra/trunk/tests/test-dict-curl.sl
   jed-extra/trunk/tests/unittesttest.sl
   jed-extra/trunk/tests/utf8helper-autoconvert-test.sl
   jed-extra/trunk/tests/utf8helper-test.sl
Log:
Moved the unit tests to jedmodes.sf.net/ CVS repo (mode/tests/)


Deleted: jed-extra/trunk/tests/ch_table-test.sl
===================================================================
--- jed-extra/trunk/tests/ch_table-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/ch_table-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,172 +0,0 @@
-% ch_table-test.sl: 
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-% Test ch_table.sl
-
-% private namespace: `ch_table'
-
-% set fixture:
-require("unittest");
-
-static define setup()
-{
-   popup_buffer("*bar*");
-   insert("bar\n");
-}
-       
-static define teardown()
-{
-   sw2buf("*bar*");
-   set_buffer_modified_flag(0);
-   close_buffer("*bar*");
-}
-
-
-% test the public defined functions:
-test_equal(is_defined("ch_table"), 2, "ch_table() should be defined");
-test_equal(is_defined("special_chars"), 2, "special_chars() should be defined");
-
-require("ch_table");
-
-% ch_table: library function  Undocumented
-%  public define ch_table () % ch_table(StartChar = 0)
-static define test_ch_table()
-{
-   ch_table();
-   test_equal(whatbuf(), "*ch_table*");
-   close_buffer("*ch_table*");
-}
-
-% special_chars: library function  Undocumented
-%  public define special_chars ()
-static define test_special_chars()
-{
-   special_chars();
-   test_equal(whatbuf(), "*ch_table*");
-   close_buffer("*ch_table*");
-}
-
-% ct_load_popup_hook: library function  Undocumented
-%  define ct_load_popup_hook (menubar)
-% test_function("ct_load_popup_hook");
-
-% int2string: undefined  Undocumented
-%  static define int2string(i, base)
-test_function("ch_table->int2string", 32, 10);
-test_last_result("32");
-test_function("ch_table->int2string", 32, 16);
-test_last_result("20");
-test_function("ch_table->int2string", 32, 8);
-test_last_result("40");
-test_function("ch_table->int2string", 32, 2);
-test_last_result("100000");
-
-% string2int: undefined  Undocumented
-%  static define string2int(s, base)
-test_function("ch_table->string2int", "32", 10);
-test_last_result(32);
-test_function("ch_table->string2int", "20", 16);
-test_last_result(32);
-test_function("ch_table->string2int", "40", 8);
-test_last_result(32);
-test_function("ch_table->string2int", "100000", 2);
-test_last_result(32);
-
-#if (_slang_utf8_ok)
-#stop
-#endif
-
-% ct_status_line: undefined  Undocumented
-%  static define ct_status_line()
-% test_function("ch_table->ct_status_line");
-
-% ct_update: undefined  Undocumented
-%  static define ct_update ()
-% test_function("ch_table->ct_update");
-
-% ct_up: undefined  Undocumented
-%  static define ct_up ()
-% test_function("ch_table->ct_up");
-
-% ct_down: undefined  Undocumented
-%  static define ct_down ()
-static define test_ct_down()
-{
-   special_chars();
-   ch_table->ct_down();
-   % () = get_y_or_n("continue");
-   test_equal(bufsubstr()[0], 170, "special_chars should highlight char 170");
-   close_buffer("*ch_table*");
-}
-
-% ct_right: undefined  Undocumented
-%  static define ct_right ()
-% test_function("ch_table->ct_right");
-
-% ct_left: undefined  Undocumented
-%  static define ct_left ()
-% test_function("ch_table->ct_left");
-
-% ct_bol: undefined  Undocumented
-%  static define ct_bol ()   { bol; ct_right;}
-% test_function("ch_table->ct_bol");
-
-% ct_eol: undefined  Undocumented
-%  static define ct_eol ()   { eol; ct_update;}
-% test_function("ch_table->ct_eol");
-
-% ct_bob: undefined  Undocumented
-%  static define ct_bob ()   { goto_line(3); ct_right;}
-% test_function("ch_table->ct_bob");
-
-% ct_eob: undefined  Undocumented
-%  static define ct_eob ()   { eob; ct_update;}
-% test_function("ch_table->ct_eob");
-
-% ct_mouse_up_hook: undefined  Undocumented
-%  static define ct_mouse_up_hook (line, col, but, shift)
-% test_function("ch_table->ct_mouse_up_hook");
-
-% ct_mouse_2click_hook: undefined  Undocumented
-%  static define ct_mouse_2click_hook (line, col, but, shift)
-% test_function("ch_table->ct_mouse_2click_hook");
-
-% ct_goto_char: undefined  Undocumented
-%  static define ct_goto_char ()
-% test_function("ch_table->ct_goto_char");
-
-% insert_ch_table: undefined  Undocumented
-%  static define insert_ch_table ()
-% test_function("ch_table->insert_ch_table");
-
-% use_base: undefined  Undocumented
-%  static define use_base (numbase)
-% test_function("ch_table->use_base");
-
-% ct_change_base: undefined  Undocumented
-%  static define ct_change_base ()
-% test_function("ch_table->ct_change_base");
-
-% setup_dfa_callback: undefined  Undocumented
-%  static define setup_dfa_callback (mode)
-% test_function("ch_table->setup_dfa_callback");
-
-% ct_insert_and_close: undefined  Undocumented
-%  static define ct_insert_and_close ()
-static define test_ct_insert_and_close()
-{
-   special_chars();
-   ch_table->ct_down();
-   ch_table->ct_insert_and_close();
-   push_mark();
-   go_left_1();
-   test_equal(bufsubstr(), "ª");
-}
-  
-update(1);
-

Deleted: jed-extra/trunk/tests/csvutils-test.sl
===================================================================
--- jed-extra/trunk/tests/csvutils-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/csvutils-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,281 +0,0 @@
-% csvutils-test.sl:  Test csvutils.sl Test csvutils.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% Versions:
-% 0.1 2006-03-03   basic test, check public functions
-% 0.2 2006-03-03   use test function discovery
-
-require("unittest");
-require("txtutils");
-require("datutils");
-
-% uncomment if you do not want to test default activation
-test_true(is_defined("buffer_compress"), "public function buffer_compress undefined");
-test_true(is_defined("format_table"), "public function format_table undefined");
-test_true(is_defined("goto_max_column"), "public function goto_max_column undefined");
-
-testmessage(" only basic test, arguments not tested completely");
-
-
-% Fixture
-% -------
-
-require("csvutils");
-
-private variable testbuf = "*bar*";
-private variable teststring = "first line \n  second   line" ;
-private variable testtable = strtok(teststring);
-reshape(testtable, [2,2]);
-private variable linelength = array_map(Int_Type, &strlen, 
-                                        strtok(teststring,"\n"));
-private variable max_linelength = array_max(linelength);   
-
-static define setup()
-{
-   sw2buf(testbuf);
-   insert(teststring);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% define get_lines() % (kill=0)
-static define test_get_lines()
-{
-   variable lines = get_lines();
-   test_equal(lines, strtok(teststring, "\n"));
-}
-
-% buffer_compress: library function
-% 
-%  SYNOPSIS
-%   Remove excess whitespace characters from the buffer
-% 
-%  USAGE
-%   Void buffer_compress(white="\t ")
-% 
-%  DESCRIPTION
-%   Calls `strcompress' on the buffer or (if visible) region.
-% 
-%  SEE ALSO
-%   trim_buffer, strcompress, get_lines, get_buffer
-static define test_buffer_compress()
-{
-   buffer_compress();
-   test_equal(get_buffer(), strjoin2d(testtable),
-      "buffer_compress() should replace in-line whithespace with tabs");
-   buffer_compress(" \t");
-   test_equal(get_buffer(), strjoin2d(testtable, " "),
-      "buffer_compress should call strcompress() on the buffer");
-}
-
-
-% strchop2d: undefined
-% 
-%  SYNOPSIS
-%   Chop a string into a 2d-array (lines and columns)
-% \usage{Array strchop2d(str, col_sep='\t', line_sep='\n', quote=0)
-%        Array strchop2d(String str, String col_sep, line_sep='\n')}
-% 
-%  DESCRIPTION
-%   The 2d equivalent to strchop and strtok. Split the string first into
-%   lines (or equivalent with line_sep != '\n') and then into fields.
-%   Return the result as a 2d-array with missing values set to NULL
-% 
-%   The datatype of col_sep determines which function is used to split
-%   the lines:
-%     if typeof(col_sep) == String_Type, use strtok, else use strchop
-% 
-%  EXAMPLE
-% 
-%    strchop2d(bufsubstr, " \t")
-% 
-%   will return the data in the region interpreted as a white-space
-%   delimited table.
-% 
-%  SEE ALSO
-%   strchop, strtok, read_table
-static define test_strchop2d()
-{
-   variable table = strchop2d(teststring, " ");
-   test_equal(table, testtable, "strchop2d should return a 2d array");
-}
-
-% get_table: undefined
-% 
-%  SYNOPSIS
-%   Return a 2d-string-array with csv data in the region/buffer
-% 
-%  USAGE
-%   String get_table(col_sep="", kill=0)
-% 
-%  DESCRIPTION
-%  Return a 2d-string-array with the data in the region/buffer
-%  The default col_sep=="" means whitespace (any number of spaces or tabs).
-%  The optional argument `kill' tells, whether the table should be
-%  deleted after reading.
-% 
-% 
-%  EXAMPLE
-% 
-%     get_table(" ");   % columns are separated by single spaces
-%     get_table(" | "); % columns are separated by space-sourounded bars
-%     get_table("");    % columns are separated by any whitespace (default)
-% 
-% 
-%  SEE ALSO
-%   strchop2d, format_table, insert_table
-static define test_get_table()
-{
-   variable table = get_table();
-   test_equal(table, testtable, "get_table should return a 2d array");
-}
-
-% strjoin2d: library function
-% 
-%  SYNOPSIS
-%   Print 2d-array as a nicely formatted table to a string
-% 
-%  USAGE
-%   Str strjoin2d(Array a, col_sep="\t", line_sep="\n", align=NULL)
-% 
-%  DESCRIPTION
-%    The function takes an 2d-array and returns a string that represents
-%    the data as an csv-table. It can be seen as a 2d-variant of
-%    strjoin(Array_Type a, String_Type delim).
-% 
-%  SEE ALSO
-%   strjoin, strchop2d, insert_table, get_table
-static define test_strjoin2d()
-{
-   variable str = strjoin2d(testtable);
-   test_equal(str, "first\tline\nsecond\tline");
-}
-
-% insert_table: undefined
-% 
-%  SYNOPSIS
-%   Print 2d-array as a nicely formatted table
-% 
-%  USAGE
-%   Void insert_table(Array a, align="l", col_sep=" ")
-% 
-%  DESCRIPTION
-%    The function takes an 2d-array and writes it as an aligned table.
-%    `col_sep' is the string separating the items on a line. It defaults 
-%    to " " (space).
-%    `align' is a format string formed of the key charaters:
-%      "l": left align,
-%      "r": right align,
-%      "c": center align, or
-%      "n": no align (actually every character other than "lrc"),
-%    one for each column. If the string is shorter than the number of columns,
-%    it will be repeated, i.e. if it contains only one character, the
-%    align is the same for all columns)
-% 
-%  EXAMPLE
-%    The call
-% 
-%         insert_table(a, " | ", "llrn");
-% 
-%    inserts `a' as a table with elements separated by " | " and
-%    first and second columns left aligned, third column right aligned
-%    and last column not aligned.
-% 
-%  SEE ALSO
-%   get_table, strjoin2d, strjoin
-static define test_insert_table()
-{
-   erase_buffer();
-   insert_table(testtable);
-   test_equal(get_buffer(), "first  line\n"
-                           +"second line\n");
-}
-
-% format_table: library function
-% 
-%  SYNOPSIS
-%   Adjust a table to evenly spaced columns
-% 
-%  USAGE
-%   format_table(col_sep=NULL, align=NULL, new_sep=NULL)
-% 
-%  DESCRIPTION
-%   Read visible region or buffer as grid data into a 2d array, reformat and
-%   insert again.  The indention of the whole table is determined by the point
-%   or mark (whichever is more left) if a visible region is defined.
-% 
-%   If the arguments are not given, they will be asked for in the minibuffer:
-%     `col_sep':     the string separating columns (default "" means whitespace)
-%     `align':       string of "l", "r", "c", or "n" (see `insert_table')
-%     `new_sep':     string to separate the columns in the output.
-% 
-%  SEE ALSO
-%   get_table, insert_table
-static define test_format_table()
-{
-   format_table("", "n", "|");
-   test_equal(get_buffer(), "first|line\nsecond|line\n");
-}
-
-% define max_column()
-static define test_max_column()
-{
-   test_equal(max_column(), max_linelength+1);
-}
-
-% goto_max_column: library function
-% 
-%  SYNOPSIS
-%   Goto the maximal column of the buffer (or region)
-% 
-%  USAGE
-%   goto_max_column()
-% 
-%  DESCRIPTION
-%  Goto the column of the longest line of the buffer (or, if visible, region).
-%  Insert whitespace if needed. The region stays marked.
-%  
-%  If the optional parameter `trim' is nonzero, trailing
-%  whitespace will be removed during the scan.
-% 
-%  NOTES
-%  This function comes handy, if you want to mark a rectagle but
-%  the last line is shorter than preceding lines.
-% 
-%  SEE ALSO
-%   max_column, goto_column, copy_rect
-static define test_goto_max_column()
-{
-   goto_max_column();
-   test_equal(what_column(), max_linelength+1,
-      "point should be at the column of the longest line in the buffer");
-}
-
-% define compute_columns() % (a, width=SCREEN_WIDTH, col_sep_length=1)
-static define test_compute_columns()
-{
-   test_equal(compute_columns(strtok(teststring), 14, 1), 2,
-      "2 columns should fit");
-}
-
-% define list2table() % (a, cols=compute_columns(a))
-static define test_list2table()
-{
-   variable table = list2table(strtok(teststring), 2);
-   test_equal(table[0,*], testtable[*,0]);
-   test_equal(table[1,*], testtable[*,1]);
-}
-
-sw2buf("*test report*");
-view_mode();

Deleted: jed-extra/trunk/tests/cuamark-test.sl
===================================================================
--- jed-extra/trunk/tests/cuamark-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/cuamark-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,144 +0,0 @@
-% cuamark-test.sl:  Test cuamark.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-10-05
-
-require("unittest");
-require("txtutils");
-
-% Fixture
-% -------
-
-require("cuamark");
-
-private variable testbuf = "*bar*";
-private variable teststring = "a test line";
-
-static define setup()
-{
-   sw2buf(testbuf);
-   insert(teststring);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% cua_mark: library function
-% 
-%  SYNOPSIS
-%   Mark a cua-region (usually, with Shift-Arrow keys)
-% 
-%  USAGE
-%   cua_mark()
-% 
-%  DESCRIPTION
-%    if no visible region is defined, set visible mark and key-hooks
-%    so that Cua_Unmarking_Functions unmark the region and
-%    Cua_Deleting_Functions delete it.
-% 
-%  SEE ALSO
-%   cua_kill_region, cua_copy_region, Cua_Unmarking_Functions, Cua_Deleting_Functions
-static define test_cua_mark()
-{
-   bob();
-   cua_mark();
-   eob();  % this should not cancel the mark (see Cua_Unmarking_Functions)
-   test_true(is_visible_mark(), "there should be a visible mark");
-   test_equal(bufsubstr(), teststring, 
-      "the marked region should equal the teststring");
-}
-
-% cua_insert_clipboard: library function
-% 
-%  SYNOPSIS
-%   Insert X selection at point
-% 
-%  USAGE
-%   Void cua_insert_clipboard()
-% 
-%  DESCRIPTION
-%  Insert the content of the X selection at point.
-%  Use, if you want to have a keybinding for the "middle click" action.
-% 
-%  NOTES
-%  This function doesnot return the number of characters inserted so it can
-%  be bound to a key easily.
-% 
-%  SEE ALSO
-%   x_insert_selection, x_insert_cutbuffer
-% static define test_cua_insert_clipboard()
-% {
-   % TODO: for some strange reason, the insertion is only visible after the next
-   % keypress!!!
-   % !if (is_defined("x_copy_region_to_selection") or 
-   %      is_defined("x_copy_region_to_cutbuffer"))
-   %   {
-   %      testmessage("I: x_copy_region_to_... not available... skipping");
-   %      return;
-   %   }
-   % mark_buffer();
-   % cua_kill_region();
-   % test_true(bobp() and eobp(), "The buffer should be empty now");
-   % cua_insert_clipboard();
-   % test_equal(get_buffer(), teststring, "The teststring should be reinserted");
-% }
-
-% cua_kill_region: library function
-% 
-%  SYNOPSIS
-%   Kill region (and copy to yp-yankbuffer [and X selection])
-% 
-%  USAGE
-%   Void cua_kill_region()
-% 
-%  DESCRIPTION
-%    Kill region. A copy is placed in the yp-yankbuffer.
-% 
-%    If `x_copy_region_to_selection' or `x_copy_region_to_cutbuffer'
-%    exist, a copy is pushed to the X selection as well.
-% 
-%  SEE ALSO
-%   yp_kill_region, cua_copy_region, yp_yank
-static define test_cua_kill_region()
-{
-   mark_buffer();
-   cua_kill_region();
-   test_true(bobp() and eobp(), "The buffer should be empty now");
-   yp_yank();
-   test_equal(get_buffer(), teststring, "yp_yank should reinsert the kill");
-}
-
-% cua_copy_region: library function
-% 
-%  SYNOPSIS
-%   Copy region to yp-yankbuffer [and X selection])
-% 
-%  USAGE
-%   Void cua_copy_region()
-% 
-%  DESCRIPTION
-%    Copy the region to the yp-yankbuffer.
-% 
-%    If `x_copy_region_to_selection' or `x_copy_region_to_cutbuffer'
-%    exist, a copy is pushed to the X selection as well.
-% 
-%  SEE ALSO
-%   yp_copy_region_as_kill, cua_kill_region, yp_yank
-static define test_cua_copy_region()
-{
-   mark_buffer();
-   cua_copy_region();
-   yp_yank();
-   test_equal(get_buffer(), teststring+teststring,
-      "yp_yank should append the copy");
-}

Deleted: jed-extra/trunk/tests/cuamouse-test.sl
===================================================================
--- jed-extra/trunk/tests/cuamouse-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/cuamouse-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,200 +0,0 @@
-% cuamouse-test.sl:  Test cuamouse.sl
-%
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03
-
-require("unittest");
-
-#ifndef XWINDOWS
-testmessage("\n  I: cuamouse only works with xjed, skipping");
-#stop
-#endif
-
-% test availability of public functions (comment to skip)
-test_true(is_defined("copy_region_to_clipboard"), "public fun copy_region_to_clipboard undefined");
-
-% Fixture
-% -------
-
-require("cuamouse");
-
-private variable testbuf = "*bar*";
-private variable teststring = "a test line\n";
-
-static define setup()
-{
-   sw2buf(testbuf);
-   % create a region from (2,2) to (4,6)
-   insert("\n");
-   insert(teststring);
-   insert("\n");
-   insert(teststring);
-   insert("\n");
-   insert(teststring);
-   goto_line(2);
-   goto_column(2);
-   push_visible_mark();
-   goto_line(4);
-   goto_column(7);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% click_in_region: library function
-%
-%  SYNOPSIS
-%   determine whether the mouse_click is in a region
-%
-%  USAGE
-%   Int click_in_region(line, col)
-%
-%  DESCRIPTION
-%    Given the mouse click coordinates (line, col), the function
-%    returns an Integer denoting:
-%           -1 - click "before" region
-%           -2 - click "after" region
-%           -3 - click in region but "void space" (i.e. past eol)
-%            0 - no region defined
-%            1 - click in region
-%
-%  SEE ALSO
-%   cuamouse_left_down_hook, cuamouse_right_down_hook
-static define test_click_in_region()
-{
-   test_equal(click_in_region(2, 2), 1, "click in the region should return 1");
-   test_equal(click_in_region(2, 9), 1, "click in the region should return 1");
-   test_equal(click_in_region(3, 1), 1, "click in the region should return 1");
-   test_equal(click_in_region(4, 6), 1, "click in the region should return 1");
-}
-
-% "before" region
-static define test_click_in_region_before()
-{
-   test_equal(click_in_region(1, 3), -1, "click before region should return -1");
-   test_equal(click_in_region(2, 1), -1, "click before region should return -1");
-}
-
-% "after" region
-static define test_click_in_region_after()
-{
-   test_equal(click_in_region(4, 7), -2, "click after region should return -2");
-   test_equal(click_in_region(4, 12), -2, "click after region should return -2");
-   test_equal(click_in_region(5, 1), -2, "click after region should return -2");
-}
-% in region but after eol
-static define test_click_in_region_after_eol()
-{
-   test_equal(click_in_region(2, 13), -3, "click after eol should return -3");
-   test_equal(click_in_region(3, 2), -3, "click after eol should return -3");
-}
-
-% no region
-static define test_click_in_region_no_region()
-{
-   pop_mark(0);
-   test_equal(click_in_region(1, 1), 0, "no region should return 0");
-   test_equal(click_in_region(2, 5), 0, "no region should return 0");
-}
-
-% copy_region_to_clipboard: library function
-%
-%  SYNOPSIS
-%   Copy region to x-selection/cutbuffer and internal mouse clipboard
-%
-%  USAGE
-%    copy_region_to_clipboard()
-%
-%  DESCRIPTION
-%    Copy region to selection/cutbuffer and internal mouse clipboard.
-%
-%    The region stays marked.
-%
-%  NOTES
-%    Tries x_copy_region_to_selection() and x_copy_region_to_cutbuffer()
-%    (in this order).
-%
-%    With CuaMouse_Use_Xclip = 1, the region is piped to the `xclip` command
-%    line tool instead. This is a workaround for interaction with applications
-%    using the QT toolkit that refuse to paste the selected text otherwise.
-%
-%  SEE ALSO
-%   CuaMouse_Use_Xclip, copy_region, yp_copy_region_as_kill
-static define test_copy_region_to_clipboard()
-{
-   copy_region_to_clipboard();
-}
-
-% define cuamouse_insert(from_jed)
-static define test_cuamouse_insert()
-{
-   dupmark();
-   variable str = bufsubstr();
-   copy_region_to_clipboard();
-   push_mark();
-   cuamouse_insert(1);
-   test_equal(bufsubstr(), str, "should insert the copied text");
-}
-
-% define cuamouse_2click_hook(line, col, but, shift) %mark word
-static define test_cuamouse_2click_hook()
-{
-   pop_mark(0);
-   cuamouse_2click_hook(1,1,1,0);
-   test_true(is_visible_mark(), "double click should mark the word");
-}
-
-% internal use, test later
-#stop
-
-% define cuamouse_drag(line, col)
-static define test_cuamouse_drag()
-{
-   cuamouse_drag();
-}
-
-% define cuamouse_left_down_hook(line, col, shift)
-static define test_cuamouse_left_down_hook()
-{
-   cuamouse_left_down_hook();
-}
-
-% define cuamouse_middle_down_hook(line, col, shift)
-static define test_cuamouse_middle_down_hook()
-{
-   cuamouse_middle_down_hook();
-}
-
-% define cuamouse_right_down_hook(line, col, shift)
-static define test_cuamouse_right_down_hook()
-{
-   cuamouse_right_down_hook();
-}
-
-% define cuamouse_down_hook(line, col, but, shift)
-static define test_cuamouse_down_hook()
-{
-   cuamouse_down_hook();
-}
-
-% define cuamouse_drag_hook(line, col, but, shift)
-static define test_cuamouse_drag_hook()
-{
-   cuamouse_drag_hook();
-}
-
-% define cuamouse_up_hook(line, col, but, shift)
-static define test_cuamouse_up_hook()
-{
-   cuamouse_up_hook();
-}

Deleted: jed-extra/trunk/tests/datutils-test.sl
===================================================================
--- jed-extra/trunk/tests/datutils-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/datutils-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,491 +0,0 @@
-% Test the functions in datutils.sl  Test datutils.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-_debug_info = 1;
-
-require("unittest");
-
-
-% Fixture
-% -------
-
-require("datutils");
-
-private variable testbuf = "*bar*";
-private variable teststring = "a test line";
-private variable intlist = {1,2,3,4}, intarray = [1,2,3,4];
-private variable strlist = {"hello", "world"}, strarray = ["hello", "world"];
-
-static define setup()
-{
-   sw2buf(testbuf);
-   insert(teststring);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% define null_fun() {}
-static define test_null_fun()
-{
-   null_fun();
-   test_equal(23, null_fun(23));
-}
-
-
-% array_max: library function
-% 
-%  SYNOPSIS
-%   Return the maximal value of an array
-% 
-%  USAGE
-%   result = array_max(Array_Type a)
-% 
-%  DESCRIPTION
-%   The `array_max' function examines the elements of a numeric array and
-%   returns the value of the largest element.
-% 
-%  EXAMPLE
-% 
-%    array_max([1,2,30,4] == 30
-% 
-% 
-%  NOTES
-%  `max' is a slang intrinsic since 1.4.6. (but must be activated manually)
-% 
-%  SEE ALSO
-%   array_sum, array_product, max, min
-static define test_array_max()
-{
-   test_equal(6, array_max([1,2,6,3]));
-   test_equal(12, array_max([1.4, 12, 3, 5.7]));
-   test_equal(-1, array_max([-12, -3,-1]));
-   test_equal(-1, array_max([-1]));
-}
-
-% array_sum: library function
-% 
-%  SYNOPSIS
-%   Return the sum of the array elements
-% 
-%  USAGE
-%   result = array_sum(a)
-% 
-%  DESCRIPTION
-%   Sum up the values of a numeric array and return the result.
-% 
-%  NOTES
-%  `sum' is a slang intrinsic since 1.4.6. (but must be activated manually)
-% 
-%  SEE ALSO
-%   array_max, array_product, sum
-static define test_array_sum()
-{
-   test_equal(1+2+3+4+5, array_sum([1:5]));
-}
-
-% array_product: library function
-% 
-%  SYNOPSIS
-%   Return the product of the array elements
-% 
-%  USAGE
-%   result = array_product(a)
-% 
-%  DESCRIPTION
-%   Multiply the values of a numeric array and return the result.
-% 
-%  SEE ALSO
-%   array_sum, array_max
-static define test_array_product()
-{
-   test_equal(2*3*4*5, array_product([2:5]));
-   test_equal(2, array_product([2]));
-}
-
-
-% list2array: library function
-%   Convert a list to an array
-%
-%  EXAMPLE
-%   `list2array' enables the use of lists in places that require an
-%   array, e.g.:
-% 
-%    message(strjoin(list2array({"hello", "world"}, String_Type), " "));
-%    23 + list2array({1, 2, 3}) == [24, 25, 26]
-static define test_list2array()
-{
-   % list2array with optional arg
-   test_equal(intarray, list2array(intlist, Integer_Type));
-   test_equal(strarray, list2array(strlist, String_Type));
-   % list2array without otional arg
-   test_equal(intarray, list2array(intlist));
-   test_equal(strarray, list2array(strlist));
-   % examples
-   test_equal("hello world", strjoin(list2array({"hello", "world"}), " "));
-   test_equal(23 + list2array({1, 2, 3}), [24, 25, 26]);
-   
-}
-
-
-% array_append: library function
-% 
-%  SYNOPSIS
-%   Append a value to an array or concatenate `a' and `b'
-% 
-%  USAGE
-%   Array = array_append(a, b)
-% 
-%  DESCRIPTION
-%  `array_append' provides a means to use 1d-arrays like lists. It
-%  concatenates `a' and `b'. 
-%   
-%  The arguments may be of any type and will be converted to Array_Type (if
-%  the not already are) before the concatenation.
-% 
-%  EXAMPLE
-%  The following statemants are all TRUE:
-% 
-%    array_append(1,2)          == [1,2]
-%    array_append(1, [2,3,4])   == [1,2,3,4]
-%    array_append([1,2], [3,4]) == [1,2,3,4]
-%    array_append([1,2,3], 4)   == [1,2,3,4]
-% 
-% 
-%  NOTES
-%  For arrays with 1000 values, it becomes time-consuming (0.13 s),
-%  for 2000 values annoying (0.5 s) and for 5000 values prohibitive (3 s)
-%  (CPU-time on a AMD-Duron 700MHz under Linux)
-% 
-%  SEE ALSO
-%   list_append
-static define test_array_append()
-{
-   test_equal(array_append(1,2)          , [1,2]);
-   test_equal(array_append(1, [2,3,4])   , [1,2,3,4]);
-   test_equal(array_append([1,2], [3,4]) , [1,2,3,4]);
-   test_equal(array_append([1,2,3], 4)   , [1,2,3,4]);
-}
-
-% array_value_exists: library function
-%   Return the number of occurences of `value' in array `a'
-static define test_array_value_exists()
-{
-   % trivial ones (translate to length(where(a == value)) )
-   test_equal(0, array_value_exists([1,2,3], 4));
-   test_equal(1, array_value_exists([1,2,3], 2));
-   test_equal(3, array_value_exists(["1", "1", "1", "W"], "1"));
-   
-   % Any_Type arrays:
-   variable a = Any_Type[4];
-   test_equal(0, array_value_exists(a, 3));
-   test_equal(4, array_value_exists(a, NULL));
-   a[1] = 3;
-   a[2] = "3";
-   a[3] = 3;
-   test_equal(1, array_value_exists(a, NULL));
-   test_equal(2, array_value_exists(a, 3));
-   test_equal(1, array_value_exists(a, "3"));
-}
-
-% assoc_get_key: library function
-%   Return the key of a value of an Associative Array
-static define test_assoc_get_key()
-{
-   variable ass = Assoc_Type[Integer_Type];
-   ass["5"] = 5;
-   ass["3"] = 3;
-   % testmessage("ass %s\n", sprint_variable(ass));
-   % testmessage("values %s\n", sprint_variable(assoc_get_values(ass)));
-   % testmessage("keys %s\n", sprint_variable(assoc_get_keys(ass)));
-   test_equal(NULL, assoc_get_key(ass, 1));
-   test_equal("5", assoc_get_key(ass, 5));
-}
-
-#stop
-   
-% pop2array: library function
-% 
-%  SYNOPSIS
-%   Return N stack-items as an array of type `type'
-% 
-%  USAGE
-%   Array_Type pop2array(N=_stkdepth, [type])
-% 
-%  DESCRIPTION
-%  Return an array that consists of the N topmost stack elements.
-%  The top element becomes element arr[N-1].
-%  If `type' is not given, autodetermine it (fall back to `Any_Type'
-%  if the element types differ).
-% 
-%  NOTES
-%  Attention: dont use `pop2array' in a function call with optional
-%  arguments , i.e. not
-% 
-%    show(pop2array())
-% 
-%  but
-% 
-%    $1 = pop2array(); 
-%    show($1);
-% 
-% 
-%  SEE ALSO
-%   array, pop2list, push_array
-static define test_pop2array()
-{
-   Arr  pop2array(N=_stkdepth, [type]);
-}
-
-% array: library function
-% 
-%  SYNOPSIS
-%   Return an array containing the arguments
-% 
-%  USAGE
-%   Array_Type array([args])
-% 
-%  DESCRIPTION
-%   Pack the arguments into an array and return it.
-%   The type is autodetermined (defaulting to `Any_Type'
-%   if the element types differ).
-% 
-%  NOTES
-%  If you know the datatype of the arguments, you can save resources pushing
-%  the arguments first and using `pop2array' with the datatype argument.
-% 
-%      (arg1, ...., argN);
-%      a = pop2array(N, datatype)
-% 
-%  instead of (the simpler)
-% 
-%      a = array(arg1, ...., argN);
-% 
-% 
-%  SEE ALSO
-%   pop2array, push_array, list2array
-static define test_array()
-{
-   Arr  = array([args]);
-}
-
-
-% array_delete: library function
-% 
-%  SYNOPSIS
-%   Delete the element(s) at position(s) `N'
-% 
-%  USAGE
-%   Array_Type array_delete(Array_Type a, Integer_Type N)
-% 
-%  USAGE
-%   Array_Type array_delete(Array_Type a, Array_Type N)
-% 
-%  DESCRIPTION
-%  Return a slice of all positions not in `N'.
-%  This provides a means to use 1d-arrays like lists.
-% 
-%  EXAMPLE
-% 
-%    array_delete([1,2,3,4], 0)      == [2,3,4]
-%    array_delete([1,2,3,4], [0,1])  == [3,4]
-%    array_delete([1,2,3,4], [0,-1]) == [2,3]
-%    array_delete([1,2,3,4], -1)     == [1,2,3]
-% 
-% 
-%  NOTES
-%  For arrays with 1000 values, it becomes time-consuming (0.09 s),
-%  for 2000 values annoying (0.32 s) and for 5000 values prohibitive (1.83 s).
-%  With SLang 2, consider using the new List_Type instead.
-% 
-%  SEE ALSO
-%   array_append, where, list_delete
-static define test_array_delete()
-{
-   Arr  = array_delete(Arr  a, i N);
-}
-
-% array_repeat: library function
-% 
-%  SYNOPSIS
-%   Repeat an array `N' times
-% 
-%  USAGE
-%   Array_Type array_repeat(a, N)
-% 
-%  DESCRIPTION
-%  Concatenate an array N-1 times to itself and return the result.
-% 
-%  SEE ALSO
-%   string_repeat, array_append
-static define test_array_repeat()
-{
-   Arr  = array_repeat(a, N);
-}
-
-% array_transpose: library function
-% 
-%  SYNOPSIS
-%   Swap the axes of a 2d array
-% 
-%  USAGE
-%   Array_Type array_transpose(a)
-% 
-%  DESCRIPTION
-%   Swap rows and columns of a 2dimensional array.
-% 
-%  SEE ALSO
-%   array_info, reshape
-static define test_array_transpose()
-{
-   Arr  = array_transpose(a);
-}
-
-% assoc_value_exists: library function
-% 
-%  SYNOPSIS
-%   Return the number of occurences of `value' in `ass'
-% 
-%  USAGE
-%   Integer_Type assoc_value_exists(Assoc_Type ass, value)
-% 
-%  DESCRIPTION
-%   Count, how many times `value' is present in the associative 
-%   array `ass'. 
-% 
-%  SEE ALSO
-%   array_value_exists, assoc_key_exists, assoc_get_key, assoc_get_values
-static define test_assoc_value_exists()
-{
-   i = assoc_value_exists(Ass ass, value);
-}
-
-% push_list: library function
-% 
-%  SYNOPSIS
-%   Push the list elements on the stack
-% 
-%  USAGE
-%   push_list(List_Type lst)
-% 
-%  DESCRIPTION
-%   Push all elements of a list to the stack. 
-%   Very convenient for converting a list to an argument list.
-% 
-%  EXAMPLE
-% 
-%    variable args = {"foo ", "bar ", "uffe "};
-%    variable str = strjoin(push_list(args));
-% 
-% 
-%  SEE ALSO
-%   pop2list, push_array
-static define test_push_list()
-{
-   push_list(List_Type = lst);
-}
-
-% pop2list: library function
-% 
-%  SYNOPSIS
-%   Return list with N topmost stack-items
-% 
-%  USAGE
-%   List_Type lst = pop2list(N=_stkdepth)
-% 
-%  DESCRIPTION
-%  Return a list that consists of the N topmost stack elements. The default
-%  is to return all elements currently on the stack.
-%  The top element becomes lst[N-1].
-% 
-%  EXAMPLE
-%  Together with `push_list', this is a convenient way to manipulate or
-%  pass on an argument list. Compared to `__pop_args'/`__push_args', 
-%  it has the advantage that the args are easily accessible via the normal
-%  index syntax and list functions:
-% 
-%    define silly() % ([args])
-%    {
-%       variable args = pop2list(_NARGS);
-%       list_append(args, "42", -1);
-%       args[1] = 3;
-%       show(push_list(args));
-%    }      
-% 
-% 
-%  NOTES
-%  Attention: dont use `pop2list' in a function call with optional
-%  arguments.
-% 
-%  SEE ALSO
-%   push_list, pop2array, _stkdepth
-static define test_pop2list()
-{
-   List_Type lst = pop2list(N=_stkdepth);
-}
-
-% array2list: library function
-% 
-%  SYNOPSIS
-%   Convert an array to a list
-% 
-%  USAGE
-%   List_Type array2list(a)
-% 
-%  DESCRIPTION
-%   Return a list of the  elements of `a'.
-% 
-%  EXAMPLE
-% 
-%    array2list([1, 2, 3]) == {1, 2, 3}
-% 
-% 
-%  SEE ALSO
-%   list2array, push_array, pop2list
-static define test_array2list()
-{
-   List_Type = array2list(a);
-}
-
-% list_concat: library function
-% 
-%  SYNOPSIS
-%   Concatenate 2 lists
-% 
-%  USAGE
-%   list_concat(l1, l2)
-% 
-%  DESCRIPTION
-%   Concatenate 2 lists by appending the elements of `l2' to `l1'.
-% 
-%  NOTES
-%   As this function uses a foreach loop over `l2', it can also be an 
-%   Array_Type object.
-% 
-%  SEE ALSO
-%   list_append, list_insert, push_list
-static define test_list_concat()
-{
-   list_concat(l1, = l2);
-}
-
-% define list_inject(l1, l2, i)
-static define test_list_inject()
-{
-   list_inject();
-}
-
-sw2buf("*test report*");
-view_mode();

Deleted: jed-extra/trunk/tests/ishell-test.sl
===================================================================
--- jed-extra/trunk/tests/ishell-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/ishell-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,182 +0,0 @@
-% Test ishell.sl
-
-% currently, this tests function calls for errors but does only a partial
-% test of advertised functionality
-
-% ishell.sl: Interactive shell mode (based on ashell.sl by J. E. Davis)
-
-% custom_variable("Ishell_default_output_placement", ">");
-% custom_variable("Ishell_logout_string", ""); % default is Ctrl-D
-% custom_variable("Ishell_Max_Popup_Size", 10);
-% custom_variable("Shell_Default_Shell", getenv ("COMSPEC"));
-% custom_variable("Ishell_Default_Shell", Shell_Default_Shell);
-% custom_variable("Shell_Default_Shell", getenv ("SHELL"));
-% custom_variable("Ishell_Default_Shell", Shell_Default_Shell+" -i");
-
-require("unittest");
-
-% Fixture
-% -------
-
-autoload("Global->ishell_send_input", "ishell");
-autoload("Global->ishell_logout", "ishell");
-autoload("get_buffer", "txtutils");
-
-private variable cmd = "echo 'hello world'";
-private variable testbuf = "*bar*";
-% the setting of ADD_NEWLINE has influence of the return value of
-% functions saving the buffer (e.g. using bufsubstring()) and processing the
-% resulting file
-private variable add_newline_before = ADD_NEWLINE;
-
-static define mode_setup()
-{
-   ADD_NEWLINE = 0;
-}
-
-static define mode_teardown()
-{
-   ADD_NEWLINE = add_newline_before;
-}
-
-static define setup()
-{
-   popup_buffer(testbuf);
-   insert("bar bar");
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% ishell_mode(cmd=Ishell_Default_Shell); Open a process and attach it to the current buffer.
-% test_function("ishell_mode");
-static define test_ishell_mode()
-{
-   ishell_mode(); % attach a shell to the buffer
-   % test the attached shell
-   %
-   % to test the proper working, we would need a way to synchronize the
-   % assynchron working (i.e. wait for a response from the command.)
-   %
-   % Maybe input_pending() can be (ab)used in conjunction with an output handler
-   % pushing a string back on the input-stream (ungetkey()). (Maybe a special
-   % blocal "Ishell_output_filter"?)
-
-   usleep(2000);  % wait for the startup
-   insert("pwd");
-   ishell_send_input();
-   usleep(1000);  % wait for the result
-   % logout
-   ishell_logout();
-   usleep(1000);  % wait for the result
-}
-
-static define test_ishell()
-{
-   ishell(); % Interactive shell
-
-   if (whatbuf() != "*ishell*")
-     throw AssertionError, "  not in *ishell* buffer";
-
-   % % logout
-   % ishell_logout();
-   % usleep(1000);  % wait for the result
-   % close
-   set_buffer_modified_flag(0);
-   delbuf("*ishell*");
-}
-
-% terminal(cmd = Ishell_Default_Shell); Run a command in a terminal
-static define test_terminal()
-{
-   % terminal();       % doesnot close!
-   terminal("exit");
-}
-
-% shell_command(cmd="", output_handling=0); Run a shell command
-static define test_shell_command_0()
-{
-   shell_command(cmd, 0); % output to "*shell-output*"
-   test_equal(get_buffer(), "hello world\n");
-   test_equal(whatbuf(), "*shell-output*");
-   close_buffer("*shell-output*");
-}
-
-static define test_shell_command_named_buffer()
-{
-   shell_command(cmd, "*foo*"); % output to buffer "*foo*"
-   test_equal(get_buffer(), "hello world\n");
-   test_equal(whatbuf(), "*foo*");
-   close_buffer("*foo*");
-}
-
-static define test_shell_command_1() % insert at point
-{
-   shell_command(cmd, 1);
-   test_equal(get_buffer(), "bar barhello world\n");
-}
-
-static define test_shell_command_2() % replace region/buffer at point
-{
-   shell_command(cmd, 2);
-   test_equal(get_buffer(), "hello world\n");
-}
-
-static define test_shell_command_3() % return output
-{
-   test_equal("hello world\n", shell_command(cmd, 3));
-}
-
-static define test_shell_command_4() % message output
-{
-   shell_command(cmd, 4);
-   test_equal("hello world\n", MESSAGE_BUFFER);
-}
-
-static define test_shell_command_ignore()
-{
-   shell_command(cmd, -1); % ignore output
-}
-
-static define test_shell_command_no_output()
-{
-   variable modename1, modename2;
-   (modename1, ) = what_mode();
-   if (bufferp("*shell-output*"))
-     {
-        sw2buf("*shell-output*");
-        set_buffer_modified_flag(0);
-        close_buffer();
-     }
-   shell_command(" "); % null-command -> no output
-   test_equal(whatbuf(), testbuf, "output buffer should close if empty");
-   (modename2, ) = what_mode();
-   test_equal(modename1, modename2, "must not change modename");
-}
-
-% shell_cmd_on_region_or_buffer: library function  Undocumented
-static define test_shell_cmd_on_region_or_buffer()
-{
-   push_visible_mark();
-   bob();
-   test_equal(shell_cmd_on_region_or_buffer("cat", 3), "bar bar");
-}
-
-% shell_cmd_on_region(cmd="", output_handling=0, postfile_args=""); Save region to a temp file and run a command on it
-static define test_shell_cmd_on_region()
-{
-   test_equal(shell_cmd_on_region("cat", 3), "bar bar");
-}
-
-% filter_region(cmd=NULL); Filter the region through a shell command
-static define test_filter_region()
-{
-   filter_region("wc");
-   % the filename part of the output differs as we use a tmp file
-   test_equal(get_buffer()[[0:4]], "0 2 7",
-      "filter_region output differs from expected value");
-}

Deleted: jed-extra/trunk/tests/listing-test.sl
===================================================================
--- jed-extra/trunk/tests/listing-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/listing-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,351 +0,0 @@
-% test-listing-list.sl:  Test listing-list.sl Test listing.sl
-%
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03
-
-require("unittest");
-autoload("get_buffer", "txtutils");
-
-% test availability of public functions (comment to skip)
-% test_true(is_defined("listing_mode"), "public fun listing_mode undefined");
-
-require("listing");
-
-% private namespace: `listing'
-
-% fixture
-static define setup()
-{
-   sw2buf("*bar*");
-   insert("three\ntest\nlines");
-}
-
-static define teardown()
-{
-   sw2buf("*bar*");
-   set_buffer_modified_flag(0);
-   close_buffer("*bar*");
-}
-
-private define clear_input()
-{
-   while (input_pending(0))
-     {
-        () = getkey();
-     }
-}
-
-
-% static define null_fun() { }
-% null_fun: just return the arguments
-static define test_null_fun()
-{
-   variable result, result2;
-   listing->null_fun();
-   test_stack();
-   result = listing->null_fun(1);
-   test_equal(result, 1);
-   (result, result2) = listing->null_fun(1, "2");
-   test_equal({result, result2}, {1, "2"});
-   test_stack();
-}
-
-% static define get_confirmation() % (prompt, [default])
-%       y: yes,
-%       n: no,
-%       !: all,
-%       q:quit,
-% Int  listing->get_confirmation(Str prompt, Str default=""); Ask whether a list of actions should go on
-static define test_get_confirmation_yes()
-{
-   listing->Dont_Ask = 0;
-   clear_input();
-   ungetkey('y');
-   test_equal(1, listing->get_confirmation("Prompt"),
-      "key 'y' should result in 1");
-   test_equal(listing->Dont_Ask, 0, "key 'y' should not change Dont_Ask");
-   clear_input();
-}
-
-static define test_get_confirmation_no()
-{
-   listing->Dont_Ask = 0;
-   clear_input();
-   ungetkey('n');
-   test_equal(0, listing->get_confirmation("Prompt"),
-      "key 'n' should result in 0");
-   test_equal(listing->Dont_Ask, 0, "key 'n' should not change Dont_Ask");
-   clear_input();
-}
-   
-static define test_get_confirmation_with_default()
-{
-   listing->Dont_Ask = 0;
-   clear_input();
-   ungetkey('\r');
-   test_equal(1, listing->get_confirmation("Prompt", "y"),
-      "key Return should use default ('y')");
-   ungetkey('\r');
-   test_equal(0, listing->get_confirmation("Prompt", "n"),
-      "key Return should use default ('n')");
-   test_equal(listing->Dont_Ask, 0, "key Return should not change Dont_Ask");
-   
-   ungetkey('n');
-   test_equal(0, listing->get_confirmation("Prompt", "y"),
-      "key 'n' should override default 'y'");
-   ungetkey('y');
-   test_equal(1, listing->get_confirmation("Prompt", "n"),
-      "key 'y' should override default 'n'");
-   clear_input();
-}
-
-static define test_get_confirmation_all()
-{
-   listing->Dont_Ask = 0;
-   clear_input();
-   ungetkey('!');
-   test_equal(1, listing->get_confirmation("Prompt"),
-      "key '!' should result in 1");
-   ungetkey('n');
-   test_equal(1, listing->get_confirmation("Prompt"),
-      "Dont_Ask 1 should ignore key (not wait for it)");
-   test_equal('n', getkey(), "Dont_Ask 1 should ignore key");
-   clear_input();
-}
-
-static define test_get_confirmation_abort()
-{
-   variable err;
-   listing->Dont_Ask = 0;
-   clear_input();
-   ungetkey('q');
-   !if (input_pending(0))
-     throw ApplicationError, "there should be a 'q' waiting at input";
-   err = test_for_exception("listing->get_confirmation", "Prompt");
-   if (err == NULL)
-     throw AssertionError, "key 'q' should abort get_confirmation()";
-   if (err.error != UserBreakError)
-     throw AssertionError, 
-     "key 'q' should throw UserBreakError not " + err.descr;
-   clear_input();
-}
-
-static define test_get_confirmation_wrong_key()
-{
-   variable err;
-   listing->Dont_Ask = 0;
-   clear_input();
-   buffer_keystring("eeeee"); % five nonaccepted keys
-   !if (input_pending(0))
-     throw ApplicationError, "there should be waiting input";
-   err = test_for_exception("listing->get_confirmation", "Prompt");
-   if (err == NULL)
-     throw AssertionError, "three wrong keys should abort get_confirmation()";
-   if (err.error != UserBreakError)
-     throw AssertionError, 
-     "three wrong keys should throw UserBreakError not " + err.descr;
-   clear_input();
-}
-
-% public define listing_mode()
-% listing_mode: library function  Undocumented
-static define test_listing_mode()
-{
-   listing_mode();
-   test_equal(pop2list(what_mode(),2 ), {"listing", 0});
-   test_equal(what_keymap, "listing");
-}
-
-% static define tags_length() % (scope=2)
-% Int tags_length(scope=2); Return the number of tagged lines.
-static define test_tags_length()
-{
-   listing_mode();
-   test_equal(0, listing->tags_length(), "no tagged line");
-}
-
-static define test_tags_length_0()
-{
-   listing_mode();
-   test_equal(1, listing->tags_length(0), "one current line");
-}
-   
-static define test_tags_length_1()
-{
-   listing_mode();
-   test_equal(1, listing->tags_length(1), "one current line");
-}
-
-static define test_tags_length_2()
-{   
-   listing_mode();
-   test_equal(0, listing->tags_length(2), "no tagged line");
-}
-
-% static define line_is_tagged()
-% line_is_tagged: Return 0 or (index of tagged line +1)
-static define test_line_is_tagged()
-{
-   listing_mode();
-   test_equal(0, listing->line_is_tagged());
-}
-
-% static define tag() % (how = 1)
-% tag(how = 1); Mark the current line and append to the Tags list
-static define test_tag()
-{
-   listing_mode();
-   listing->tag();
-   test_stack();
-   % now there should be 1 tagged line
-   test_equal(1, listing->line_is_tagged(), "current line is tagged");
-   test_equal(1, listing->tags_length, "one tagged line");
-   % tag a second line
-   bob();
-   listing->tag();
-   test_equal(2, listing->tags_length(), "2 tagged lines");
-   test_equal(2, listing->line_is_tagged(), "current line should be second tag");
-   % untag current line
-   listing->tag(0);
-   test_stack();
-   test_equal(0, listing->line_is_tagged(), "current line not tagged");
-   test_equal(1, listing->tags_length, "one tagged line");
-   % toggle current line tag
-   listing->tag(2);
-   test_equal(2, listing->tags_length(), "2 tagged lines");
-}
-
-
-% static define tag_all() % (how = 1)
-% tag_all(how = 1); (Un)Tag all lines
-static define test_tag_all()
-{
-   listing_mode();
-   bob();
-   listing->tag_all();
-   test_stack();
-   test_equal(3, listing->tags_length(), "3 tagged lines");
-   test_true(bobp(), "tag_all() should not move the point");
-   % untag current line
-   listing->tag(0);
-   test_equal(0, listing->line_is_tagged(), "current line not tagged");
-   test_equal(2, listing->tags_length, "should be 2 tagged lines");
-   % toggle
-   listing->tag_all(2);
-   test_equal(1, listing->line_is_tagged(), "current line should be tagged");
-   test_equal(1, listing->tags_length, "should be 1 tagged line");
-   % untag
-   listing->tag_all(0);
-   test_equal(0, listing->tags_length(2), "no tagged line");
-}
-
-
-% static define tag_matching() %(how)
-% tag_matching: undefined  Undocumented
-static define test_tag_matching()
-{
-   clear_input();
-   listing_mode();
-   buffer_keystring("th\r"); % simulate keyboard input
-   listing->tag_matching();
-   test_equal(1, listing->tags_length, "should be 1 tagged line");
-   
-   clear_input();
-   buffer_keystring("t\r");
-   listing->tag_matching();
-   test_equal(2, listing->tags_length, "should be 2 tagged lines");
-   clear_input();
-}
-
-
-% public  define listing_list_tags() % (scope=2, untag=0)
-% scope: 0 current line, 1 tagged or current line(s), 2 tagged lines
-
-% Arr[Str] listing_list_tags(scope=2, untag=0); Return an array of tagged lines.
-static define test_listing_list_tags()
-{
-   listing_mode();
-   listing->tag_all();
-   test_equal(["three", "test", "lines"], listing_list_tags(),
-     "listing_list_tags() should return the tagged lines as String array");
-   !if (3 == listing->tags_length)
-     throw AssertionError, "there should be 3 tagged lines";
-}
-static define test_listing_list_tags_0()
-{
-   listing_mode();
-   listing->tag_all();
-   test_equal(["lines"], listing_list_tags(0),
-     "listing_list_tags(0) should return the current line as String array");
-   !if (3 == listing->tags_length)
-     throw AssertionError, "there should be 3 tagged lines";
-}
-static define test_listing_list_tags_1_non_tagged()
-{
-   listing_mode();
-   test_equal(["lines"], listing_list_tags(1),
-     "listing_list_tags(1) should return the tagged lines as String array");
-   !if (0 == listing->tags_length)
-     throw AssertionError, "there should be no tagged line";
-}
-static define test_listing_list_tags_1_tagged()
-{
-   listing_mode();
-   listing->tag_all();
-   test_equal(["three", "test", "lines"], listing_list_tags(1),
-     "listing_list_tags(1) should return the tagged lines as String array");
-   !if (3 == listing->tags_length)
-     throw AssertionError, "there should be 3 tagged lines";
-}
-static define test_listing_list_tags_2_1()
-{
-   listing_mode();
-   listing->tag_all();
-   test_equal(["three", "test", "lines"], listing_list_tags(2, 1),
-     "listing_list_tags should return the tagged lines as String array");
-   !if (0 == listing->tags_length)
-     throw AssertionError, "all lines should be untagged";
-}
-static define test_listing_list_tags_2_2()
-{
-   listing_mode();
-   listing->tag_all();
-   test_equal(["three", "test", "lines"], listing_list_tags(2, 2),
-     "listing_list_tags should return the tagged lines as String array");
-   !if (bobp and eobp)
-     {
-        testmessage("buffer content: '%s'", get_buffer());
-        throw AssertionError, "all lines should be deleted";
-     }
-}
-
-
-% public  define listing_map() % (scope, fun, [args])
-% listing_map(Int scope, Ref fun, Any [args]); Call a function for marked lines.
-%
-% this is implicitely tested by listing_list_tags()
-
-% static define listing_update_hook()
-% listing_update_hook: undefined  Undocumented
-%
-% this is interactively tested
-
-
-% static define listing_menu (menu)
-% listing_menu: undefined  Undocumented
-% static define test_listing_menu()
-% {
-%    listing_mode();
-%    menu_select_menu("Global.M&ode.Tag &All");
-%    !if (3 == listing->tags_length)
-%      throw AssertionError, "there should be 3 tagged lines";
-% }
-
-
-% static define edit()
-% edit: undefined  Undocumented
-% test_function("listing->edit");
-% test_last_result();

Deleted: jed-extra/trunk/tests/pymode-test.sl
===================================================================
--- jed-extra/trunk/tests/pymode-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/pymode-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,677 +0,0 @@
-% pymode-test.sl:  Test pymode.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-require("unittest");
-
-% test availability of public functions (comment to skip)
-test_true(is_defined("python_shell"), "public fun python_shell undefined");
-test_true(is_defined("python_mode"), "public fun python_mode undefined");
-
-% Fixture
-% -------
-
-require("pymode");
-
-private variable testbuf = "*pymode test*";
-private variable teststring = strjoin(
-   ["import sys",
-    "from os.path import dirname, exists, \\",
-    "                lexists",
-    "# a comment",
-    "def unindent(self,",
-    "    indent=None):",
-    "    \"\"\"Return unindented list of lines",
-    "",   
-    "    Unindents by the least (or given) indentation level\"\"\"",
-    "    if indent is None:",
-    "        indent = self.min_indent()",
-    "    else:",
-    "        indent = 0",
-    "    par = [line[indent:] ",
-    "           for line in self]",
-    "    return PylitParagraph(par)",
-    ""
-    ], "\n");
-% show_string(teststring);
-
-private variable literal_strings__teststring = strjoin(
-   ["''' 'in' ''' out",
-    "\"\"\" \"in\" \"\"\" out",
-    "''' in ",
-    "in ''' out",
-    "\"\"\" in ",
-    "in \"\"\" out",
-    "''' in \"\"\" in ''' out",
-    "\"\"\" in ",
-    "''' in",
-    "\"\"\" out ''' in ''' out",
-    "' in \"\"\" in \\\' in \" in ' out",
-    "\" in ''' in \\\" in ' in \" out",
-    "\" ' in",
-    "out '''",
-    " in \"\"\" in "], "\n");
-% show_string(literal_strings__teststring);
-
-static define setup()
-{
-   sw2buf(testbuf);
-   insert(teststring);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% test whether the point is inside a long string literal (""" """ or ''' ''')
-% static define in_literal_string()
-static define test_in_literal_string()
-{
-   erase_buffer();
-   insert(literal_strings__teststring);
-   bob;
-   while (fsearch("in"))
-     {
-        test_true(python->in_literal_string(),
-           sprintf("inside string literal: %d %s", 
-              what_line, line_as_string()));
-        go_right(2);
-     }
-   bob;
-   while (fsearch("out"))
-     {
-        test_true(not(python->in_literal_string()),
-           sprintf("outside string literal: %d %s", 
-              what_line, line_as_string()));
-        go_right(3);
-     }
-}
-
-% define py_is_continuation_line()
-% recognize continuation lines (after \, inside """ """, (), [], and {})
-static define test_py_is_continuation_line()
-{
-   variable continuation_lines = [3, 6, 8, 9, 15];
-   bob();
-   do
-     {
-        % vshow("line %d: continues at %d", 
-        %    what_line, py_is_continuation_line());
-        if (wherefirst(what_line() == continuation_lines) != NULL)
-          test_true(python->is_continuation_line(),
-             sprintf("line %d '%s' is a continuation line", 
-                what_line(), line_as_string()));
-        else
-          test_true(not(python->is_continuation_line()),
-             sprintf("line %d '%s' is no continuation line", 
-                what_line(), line_as_string()));
-     }
-   while (down_1());
-}
-
-static define test_py_is_indented_code_line()
-{
-   % line-numbers of indented code lines in the teststring
-   variable indented_code_lines = [7, 10, 11, 12, 13, 14, 16];
-   
-   bob();
-   do
-     {
-        % testmessage(sprintf("\n  line %d: continues at %d", 
-        %    what_line, python->is_continuation_line()));
-        if (wherefirst(what_line() == indented_code_lines) != NULL)
-          test_true(python->is_indented_code_line(),
-             sprintf("line %d '%s' is an indented_code line", 
-                what_line(), line_as_string()));
-        else
-          test_true(not(python->is_indented_code_line()),
-             sprintf("line %d '%s' is no indented_code line", 
-                what_line(), line_as_string()));
-     }
-   while (down_1());
-}
-
-% Determine the buffer-local indentation level
-% 
-% Try the blocal variable "Py_Indent_Level", 
-%     the first indented code line, or
-%     the global Py_Indent_Level.
-% store in blocal variable
-static define test_get_indent_level()
-{
-   test_equal(python->get_indent_level(), 4, "default is 4 spaces");
-   goto_line(2);
-   insert("\t");
-   test_equal(python->get_indent_level(), 4, "value should be cached");
-}
-
-static define test_get_indent_level_tab()
-{
-   goto_line(2);
-   insert("\t");
-   % () = get_y_or_n("continue");
-   test_equal(python->get_indent_level(), 0, "tab use should return 0");
-   
-}
-
-static define test_get_indent_level_default()
-{
-   erase_buffer();
-   test_equal(python->get_indent_level(), Py_Indent_Level , 
-      "should return Py_Indent_Level if there are no indented code lines");
-}
-
-% get the width of the expanded indent string (indent_level or TAB)
-static define test_get_indent_width()
-{
-   test_equal(python->get_indent_width(), 4, 
-      "should return get_indent_level() if it is > 0");
-   define_blocal_var("Py_Indent_Level", 0);
-   test_equal(python->get_indent_width(), TAB,
-      "should return TAB if indent-level is 0 (tab use)");
-}
-
-% static define check_indentation()
-% Test whether code indentation mixes tabs and spaces
-% Leave point at the first non-white char in the offending line
-static define test_check_indentation()
-{
-   test_equal(' ', python->check_indentation(),
-      "false alarm: is there really a tab in '" + line_as_string() + "' ?");
-   % tab in continuation line
-   goto_line(3); 
-   bol();
-   insert("\t");
-   test_equal(' ', python->check_indentation(),
-      "should ignore tab in continuation line");
-   % tab in code line
-   goto_line(7);
-   insert("\t");
-   eob();
-   test_equal(0, python->check_indentation(),
-      "should find tab in indented code line");
-   test_equal(what_line(), 7, "should place point in first offending line");
-   % convert spaces to tabs:
-   bob();
-   replace("    ", "\t");
-   define_blocal_var("Py_Indent_Level", 0);
-   test_equal('\t', python->check_indentation(),
-      "false alarm: is there really a space in " + line_as_string());
-}
-
-% static define calculate_indent_col()
-% Parse last line(s) to estimate the correct indentation for the current line
-% 
-% Used in py_indent_line, indent_line_hook (for indent_line() and
-% newline_and_indent(), and electric_colon()
-static define test_calculate_indent()
-{
-   variable i=1, indent, indents = [0,0,0,0,0,13,4,4,0,4,8,4,8,8,11,4,0];
-   
-   bob();
-   foreach indent (indents)
-     {
-        test_equal(indent, python->calculate_indent(),
-           sprintf("wrong estimate in line %d", i));
-        go_down_1();
-        i++;
-     }
-}
-
-% define py_indent_line()
-static define test_py_indent_line()
-{
-   bob();
-   % indent by given amount
-   py_indent_line(7);
-   bol_skip_white();
-   test_equal(what_column()-1, 7, "should indent to given amount");
-   test_equal(bfind("\t"), 0, 
-      "must not use tabs for indentation if indent-level != 0");
-
-   % Indent to calculated column
-   % no indent
-   py_indent_line();
-   bol_skip_white();
-   test_equal(what_column()-1, 0, "should remove spurious indentation");
-   % indented line (1 level)
-   () = fsearch("if indent is None:");
-   bol_trim();
-   py_indent_line();
-   bol_skip_white();
-   test_equal(what_column()-1, Py_Indent_Level, "should indent to previous line");
-   % more variants are tested via test_calculate_indent_col()
-   
-   % indent with tabs
-   define_blocal_var("Py_Indent_Level", 0);
-   py_indent_line(2*TAB);
-   bol_skip_white();
-   test_equal(what_column()-1, 2*TAB, 
-      "should indent to given amount also if using tabs");
-   test_equal(bfind(" "), 0, 
-      "must not use spaces indentation if indent-level == 0 and width is multiple of TAB");
-}
-
-
-%\function{python->py_shift_line_right}
-%Increase the indentation level of the current line
-static define test_py_shift_line_right()
-{
-   % define_blocal_var("Py_Indent_Level", 4); % calculated from teststring
-   TAB = 8;
-   bob;
-   % Indent one level
-   variable i;
-   foreach i ([0,1,2,3])
-      {
-         bol_trim();
-         whitespace(i);
-         python->py_shift_line_right();
-         bol_skip_white();
-         test_equal(what_column()-1, Py_Indent_Level,
-            sprintf("should indent from %d to next Py_Indent_Level", i));
-      }
-   % Indent one more level
-   foreach i ([4,5,6,7])
-      {
-         bol_trim();
-         whitespace(i);
-         python->py_shift_line_right();
-         bol_skip_white();
-         test_equal(what_column()-1, 2*Py_Indent_Level,
-            sprintf("should indent from %d to next Py_Indent_Level", i));
-      }
-   % Indent with spaces (test now, as TAB is 2*Py_Indent_Level)
-   test_equal(0, bfind("\t"), "should indent with spaces");
-   
-   % Indent several levels at once with prefix argument
-   bol_trim(); 
-   set_prefix_argument(3);
-   python->py_shift_line_right();
-   bol_skip_white();
-   test_equal(what_column()-1, 3*Py_Indent_Level, 
-      "should indent by prefix-arg * Py_Indent_Level");
-}
-
-static define test_py_shift_line_right_with_tabs()
-{
-   bob;
-   % Indent with tabs if get_indent_level returns 0
-   define_blocal_var("Py_Indent_Level", 0);
-   python->py_shift_line_right();
-   test_equal(what_column(), TAB+1,
-      "should indent by TAB");
-   test_true(blooking_at("\t"), "should indent with tabs");
-}
-
-% py_shift_region_right: undefined
-%   Increase the indentation level of the region
-static define test_py_shift_region_right()
-{
-   bob();
-   push_mark();
-   python->py_shift_region_right();
-   bol_skip_white();
-   test_equal(what_column()-1, Py_Indent_Level, 
-      "should indent by Py_Indent_Level");
-   test_equal(count_narrows(), 0, "still narrowed");
-   test_equal(markp(), 0, "mark left");
-}
-
-% py_shift_right: undefined
-%   Increase code indentation level
-%   If a `prefix_argument' is set, indent the number of levels
-%   given in the prefix argument.
-static define test_py_shift_right()
-{
-   bob();
-   set_prefix_argument(3);
-   py_shift_right();
-   bol_skip_white();
-   test_equal(what_column()-1, 3*Py_Indent_Level, 
-      "should indent by 3*Py_Indent_Level");
-}
-
-% define py_shift_line_left()
-static define test_py_shift_line_left()
-{
-   % set indent leve because we fiddle with the teststring!
-   define_blocal_var("Py_Indent_Level", 4); 
-   TAB = 8;
-   bob;
-   % Unindent to bol
-   variable i;
-   foreach i ([1,2,3,4])
-      {
-         bol_trim();
-         whitespace(i);
-         python->py_shift_line_left();
-         bol_skip_white();
-         test_equal(what_column()-1, 0,
-            sprintf("should unindent from %d to bol", i));
-      }
-   % Unindent to first level
-   foreach i ([5,6,7,8])
-      {
-         bol_trim();
-         whitespace(i);
-         python->py_shift_line_left();
-         bol_skip_white();
-         test_equal(what_column()-1, 4,
-            sprintf("should unindent from %d to first Py_Indent_Level", i));
-      }
-   % test the saveguard error
-   bol_trim();
-   variable err = test_for_exception("python->py_shift_line_left");
-   if (orelse{err == NULL}{err.error != RunTimeError})
-     throw AssertionError, 
-     "should abort if there is not enough indentation";
-}
-
-% define py_shift_region_left()
-static define test_py_shift_region_left()
-{
-   bol_trim();
-   whitespace(Py_Indent_Level);
-   push_mark();
-   python->py_shift_region_left();
-   bol_skip_white();
-   test_equal(what_column()-1, 0, "should dedent by Py_Indent_Level");
-   test_equal(count_narrows(), 0, "still narrowed");
-   test_equal(markp(), 0, "mark left");
-}
-
-% define py_shift_left() {
-%\synopsis{Decrease code indentation level}
-static define test_py_shift_left()
-{
-   bol_trim();
-   whitespace(Py_Indent_Level);
-   py_shift_left();
-   bol_skip_white();
-   test_equal(what_column()-1, 0, "should dedent by Py_Indent_Level");
-   bol_trim();
-   whitespace(3*Py_Indent_Level);
-   set_prefix_argument(3);
-   py_shift_left();
-   bol_skip_white();
-   test_equal(what_column()-1, 0, "should dedent by 3*Py_Indent_Level");
-}
-
-% public  define py_untab()
-%   Convert tabs to `Py_Indent_Level' spaces or
-%   spaces to tabs (with prefix argument)
-%   Replace all hard tabs ("\\t") with spaces 
-%  NOTES
-%   Other than `untab', `py_untab' acts on the whole buffer, not on a
-%   region.
-static define test_py_untab()
-{
-   % spaces to tabs (with prefix argument)
-   set_prefix_argument(1);
-   py_untab();
-   bob();
-   test_equal('\t', python->check_indentation(),
-      "there should be only tabs in code indentation"
-      +"(if the indents are a multipel of TAB)");
-   test_equal(0, python->get_indent_level,
-      "set local indent level to 0 (indent with tabs)");
-   % tabs to spaces
-   py_untab();
-   bob();
-   test_equal(0, fsearch("\t"), "there should be no tabs in the buffer");
-   test_equal(TAB, python->get_indent_level,
-      "set local indent level to TAB");
-}
-
-% static define reindent_buffer()
-%   Reindent buffer using `Py_Indent_Level'
-%  DESCRIPTION
-%   Reformat current buffer to consistent indentation levels. using the current
-%   relative indentation and the value of get_indent_width().
-%   Abort if the current indentation violates the Python syntax.
-static define test_reindent_buffer()
-{
-   define_blocal_var("Py_Indent_Level", 0);
-   TAB=8;
-   python->reindent_buffer();
-   test_equal('\t', python->check_indentation(),
-      "there should be only tabs in code indentation");
-   % reindent with given value
-   python->reindent_buffer(4);
-   test_equal(4, python->get_indent_level,
-      "should set local indent level to 4");
-   test_equal(0, fsearch("\t"), "there should be no tabs in the buffer");
-   % mark_buffer();
-   % show(bufsubstr());
-   % show(teststring);
-   mark_buffer();
-   test_equal(bufsubstr(), teststring, "should be back to original indent");
-}
-
-static define test_reindent_buffer_zero_TAB()
-{
-   TAB=0;
-   % reindent_buffer should set TAB to 4 to prevent indent by 0 spaces!
-   python->reindent_buffer(0);
-   test_equal('\t', python->check_indentation(),
-      "there should be only tabs in code indentation");
-   % reindent with given value
-   python->reindent_buffer(4);
-   test_equal(4, python->get_indent_level,
-      "should set local indent level to 4");
-   test_equal(0, fsearch("\t"), "there should be no tabs in the buffer");
-   mark_buffer();
-   test_equal(bufsubstr(), teststring, "should be back to original indent");
-}
-
-% static define reindent_block()
-% reindent the current block or all blocks that overlap with a visible region
-static define test_reindent_block()
-{
-   eob();
-   insert("def ulf():\n");
-   insert("    quatsch()\n");
-   insert("    batch()\n");
-   insert("\n");
-   insert("# last comment\n");
-   
-   define_blocal_var("Py_Indent_Level", 0);
-   % call reindent_block on last line
-   set_buffer_modified_flag(0);
-   python->reindent_block();
-   test_equal(0, buffer_modified(), 
-      "should do nothing if on non-indented line that doesnot start a block");
-   % call on last block
-   () = bsearch("quatsch");
-   python->reindent_block();
-   bol();
-   test_true(looking_at_char('\t'), "should indent block with tabs");
-   % this should move the point into the first block
-   test_equal(0, python->check_indentation(), "now tabs and spaces are mixed");
-   python->reindent_block();
-   % as there are only 2 blocks, indentation should be clean again
-   test_equal('\t', python->check_indentation(), "should be only tabs");
-}
-
-% Magic keys
-% ----------
-
-% define electric_colon()
-% dedent a line one level, if it is the start of a new block
-static define test_electric_colon()
-{
-   insert("\n   else");
-   python->electric_colon();
-   bol_skip_white();
-   test_equal(what_column(), 1);
-   insert("\n   elise"); % not a subblock starter
-   python->electric_colon();
-   bol_skip_white();
-   test_equal(what_column(), 4);
-}
-
-
-% define electric_delim(ch)
-% Currently not used due to unsolved problems
-static define test_electric_delim()
-{
-   python->electric_delim(')');
-}
-
-% define py_backspace_key()
-% shift line right if we are at the first non-white space in an indented
-% line,  normal action else
-static define test_py_backspace_key()
-{
-   variable line, col;
-   % inside code: just delete prev char
-   bob;
-   () = fsearch("self.min_indent");
-   line = what_line(), col = what_column();
-   python->py_backspace_key();
-   test_equal(col-1, what_column(), "should delete prev char normally");
-   % goto first non-white char
-   bol_skip_white();
-   col = what_column();
-   python->py_backspace_key();
-   test_equal(col-Py_Indent_Level, what_column, 
-      "should dedent line if at first non-white space");
-   bol;
-   python->py_backspace_key();
-   test_equal(line-1, what_line(), "should del prev newline if at bol");
-}
-
-% define py_exec()
-% Run python interpreter on current region or the whole buffer.
-% Display output in *python-output* buffer window.
-static define test_py_exec()
-{
-   bob();
-   insert("print 2 + 2 #");
-   py_exec();
-   % () = get_y_or_n("continue");
-   test_true(bufferp("*python output*"), 
-      "should open output buffer (if there is output from python)");
-   close_buffer("*python output*");
-}
-
-% public define python_shell()
-% attach python session to buffer
-static define test_python_shell_interactive()
-{
-   python_shell();
-   testmessage("test interactive!");
-}
-
-% define py_help_on_word()
-% #ifdef MSWINDOWS
-% static define test_py_help_on_word()
-% {
-%    py_help_on_word();
-% }
-% #endif
-
-% define get_import_lines()
-% find lines with global imports (import ... and  from ... import ...)
-static define test_get_import_lines()
-{
-   % get the teststring up to the comment (minus the newline)
-   variable import_lines = teststring[[:is_substr(teststring, "#")-2]];
-   
-   test_equal(import_lines, python->get_import_lines());
-   erase_buffer();
-   test_equal("", python->get_import_lines());
-}
-
-% py_help: undefined
-% 
-%  SYNOPSIS
-%   Run python's help feature on topic
-% 
-%  USAGE
-%    Void py_help([String topic])
-% 
-%  DESCRIPTION
-%    Call python help on topic and display the help text in a window.
-%    If the topic is not given, ask in the minibuffer.
-% 
-%  NOTES
-%    Only tested on UNIX
-% 
-%  SEE ALSO
-%   py_mode
-static define test_py_help()
-{
-   py_help("string.whitespace");
-   test_true(bufferp("*python-help*"), 
-      "should open help buffer");
-   test_true(fsearch("string.whitespace"),
-      "should display help on 'string.whitespace'");
-   close_buffer("*python-help*");
-}
-
-
-% define py_help_for_word_hook(word)
-% (add "." to word chars);
-static define test_python_help_for_word_hook()
-{
-   insert(" string.whitespace");
-   python->python_help_for_word_hook("dummy");
-   test_true(bufferp("*python-help*"), 
-      "should open help buffer");
-   setbuf("*python-help*");
-   bob();
-   test_true(fsearch("string.whitespace"),
-      "should display help on 'string.whitespace'");
-   % () = get_y_or_n("continue");
-   close_buffer("*python-help*");
-}
-
-% define py_browse_module_doc() % (module=NULL)
-static define test_py_browse_module_doc_interactive()
-{
-   message("should open help for module 'os' in browser");
-   py_browse_module_doc("os");
-   testmessage("needs interactive testing (opens external browser)");
-}
-
-% python_mode: library function
-% 
-%  SYNOPSIS
-%   Mode for editing Python files.
-% 
-%  USAGE
-%   Void python_mode()
-% 
-%  DESCRIPTION
-%  A major mode for editing scripts written in Python (www.python.org).
-% 
-%  The following keys have python specific bindings:
-% 
-%   Backspace   deletes to previous indentation level
-%   : (colon)   dedents appropriately
-%   (the next assume `_Reserved_Key_Prefix' == "^C")
-%   ^C#         comments region or current line
-%   ^C>         shifts line or region right
-%   ^C<         shifts line or region left
-%   ^C^C        executes the region, or the buffer if region not marked.
-%   ^C|         executes the region
-% 
-% 
-%  SEE ALSO
-%   Py_Indent_Level, Py_Use_Tabs, py_reindent, python->py_untab
-static define test_python_mode()
-{
-   python_mode();
-}

Deleted: jed-extra/trunk/tests/rst-test.sl
===================================================================
--- jed-extra/trunk/tests/rst-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/rst-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,292 +0,0 @@
-% rst-test.sl:  Test rst.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-require("unittest");
-
-% Customization
-% -------------
-% 
-% Set 
-%   Unittest_Skip_Patterns = [Unittest_Skip_Patterns, "long"];  
-% to skip long running tests.
-
-% test availability of public functions (comment to skip)
-test_true(is_defined("rst_mode"), "public fun rst_mode undefined");
-
-% Fixture
-% -------
-
-require("rst");
-
-private variable testfile = make_tmp_file("rst-testfile.txt");
-private variable testbuf = path_basename(testfile);
-private variable teststring = "a test line";
-
-static define setup()
-{
-   () = find_file(testfile);
-   insert(teststring);
-   save_buffer();
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-   test_true(delete_file(testfile), "cleanup failed");
-}
-
-% private namespace: `rst'
-
-
-% Test functions
-% --------------
-
-% static define rst_export() % (to, outfile=path_sans_extname(whatbuf())+"."+to)
-static define test_rst_export_long()
-{
-   variable to = "html";
-   variable outfile = path_sans_extname(buffer_filename()) + "." + to;
-
-   rst->rst_export(to);
-   
-   test_true(delete_file(outfile), "should create output file");
-}
-
-% public  define rst_to_html()
-static define test_rst_to_html_long()
-{
-   variable outfile = path_sans_extname(buffer_filename()) + ".html";
-   rst_to_html();
-
-   test_true(delete_file(outfile), "should create html output");
-}
-
-% public  define rst_to_latex() % (outfile=path_sans_extname(whatbuf())+".tex")
-static define test_rst_to_latex_long()
-{
-   variable outfile = path_sans_extname(buffer_filename()) + ".tex";
-
-   rst_to_latex();
-   
-   test_true(delete_file(outfile), "should create latex output");
-}
-
-% public  define rst_to_pdf() % (outfile=path_sans_extname(whatbuf())+".pdf")
-static define test_rst_to_pdf_long()
-{
-   % testmessage("rst2pdf still not working");
-   % return;
-   
-   variable outfile = path_sans_extname(buffer_filename()) + ".pdf";
-
-   rst_to_pdf();
-   
-   test_true(delete_file(outfile), "should create pdf output");
-}
-
-% static define command_help(cmd)
-static define test_command_help()
-{
-   rst->command_help("ls foo");
-   test_equal(whatbuf(), "*rst export help*", "should open help buffer");
-   close_buffer("*rst export help*");
-}
-
-% static define set_export_cmd(export_type)
-static define test_set_export_cmd_html_long()
-{
-   variable testcmd = " --option", old_cmd = Rst2Html_Cmd;
-   buffer_keystring(testcmd + "\r");
-   rst->set_export_cmd("html");
-   test_equal(Rst2Html_Cmd, old_cmd + testcmd);
-   Rst2Html_Cmd = old_cmd;}
-
-static define test_set_export_cmd_tex_long()
-{
-   variable testcmd = " --option", old_cmd = Rst2Latex_Cmd;
-   buffer_keystring(testcmd + "\r");
-   rst->set_export_cmd("tex");
-   test_equal(Rst2Latex_Cmd, old_cmd + testcmd);
-   Rst2Latex_Cmd = old_cmd;
-}
-
-static define test_set_export_cmd_pdf_long()
-{
-   variable testcmd = " --option", old_cmd = Rst2Pdf_Cmd;
-   buffer_keystring(testcmd + "\r");
-   rst->set_export_cmd("pdf");
-   test_equal(Rst2Pdf_Cmd, old_cmd + testcmd);
-   Rst2Pdf_Cmd = old_cmd;
-}
-
-% public  define rst_view_html() % (browser=Browse_Url_Browser))
-% Needs interactive testing.
-static define test_rst_view_html_interactive()
-{
-   rst_view_html();
-}
-
-% static define markup(type)
-static define test_markup()
-{
-   rst->markup("strong");
-   test_equal("a test **line**", line_as_string(), "should mark up last word");
-}
-
-
-% static define block_markup(type)
-static define test_block_markup()
-{
-   insert("\n   strong");
-   rst->block_markup("strong");
-   test_equal("**strong**", line_as_string(), 
-      "should mark up last word and (re) indent");
-}
-
-% static define insert_directive(directive_type)
-static define test_insert_directive()
-{
-   rst->insert_directive("test");
-   test_equal(".. test:: ", line_as_string(), 
-      "should insert directive on a line on its own");
-}
-
-
-% static define section_header() % ([underline_character]) % as string
-static define test_section_header()
-{
-   variable ul_string = string_repeat("+", strlen(teststring));
-   
-   rst->section_header(ul_string[[0]]);
-   go_up_1();
-   test_equal(ul_string, line_as_string(), 
-      "should underline with given character");
-   
-   insert(ul_string + "\t");
-   rst->section_header(ul_string[[0]]);
-   test_true(eobp(), "should replace existing section markup");
-   go_up_1();
-   test_equal(ul_string, line_as_string(), 
-      "should adapt length of underline");
-   
-   ul_string = string_repeat("-", strlen(teststring));
-   rst->section_header(ul_string[[0]]);
-   test_true(eobp(), "should replace existing section markup");
-   go_up_1();
-   test_equal(ul_string, line_as_string(), 
-      "should change section markup");
-}
-
-   
-static define test_section_header_replace()
-{
-   variable ul_string = string_repeat("+", strlen(teststring));
-   newline();
-   insert(ul_string + " " + ul_string);
-   bob();
-   rst->section_header(ul_string[[0]]);
-   go_up_1();
-   test_equal(ul_string, line_as_string(), 
-      "should insert section markup");
-   eob();
-   test_equal(ul_string + " " + ul_string, line_as_string(),
-      "should keep next line if it is not section markup");
-}
-
-
-static define test_section_header_numeric()
-{
-   variable level, ul_string;
-   
-   for (level = 0; level < strlen(rst->Underline_Chars); level++)
-     {
-        ul_string = string_repeat(rst->Underline_Chars[[level]], 
-           strlen(teststring));
-        rst->section_header(level);
-        go_up_1();
-        test_equal(ul_string, line_as_string(), 
-           "should underline with given level, replacing existing markup");
-     }
-}
-
-  
-  
-#ifexists list_routines
-
-% static  define rst_list_routines_extract (nRegexp)
-static define test_rst_list_routines_extract()
-{
-   test_equal("", rst->rst_list_routines_extract(0),
-      "should return empty string if not on a section header");
-   
-   variable adornment = string_repeat("+", strlen(teststring));
-   % testmessage("\n" + line_as_string);
-   insert("\n" + adornment);
-   % testmessage("\n" + line_as_string);
-   bol();
-   test_equal("+ a test line", rst->rst_list_routines_extract(0),
-      "should return section header preceded by adornment character");
-
-   delete_line();
-   insert("------");
-   bol();
-   test_equal("", rst->rst_list_routines_extract(0),
-      "should return empty string if underline too short");
-
-   newline();
-   insert("\n\n------");
-   bol();
-   test_equal("", rst->rst_list_routines_extract(0),
-      "should return empty string if on a transition");
-
-   newline();
-   insert("\n\n::");
-   bol();
-   test_equal("", rst->rst_list_routines_extract(0),
-      "should return empty string if on a literal block marker");
-
-   newline();
-   insert("\n\nsubsection");
-   insert(  "\n----------");
-   bol();
-   test_equal("  - subsection", rst->rst_list_routines_extract(0),
-      "should return sub section header");
-
-}
-
-#endif
-
-
-% static define new_popup(menu, popup)
-static define test_new_popup()
-{
-   variable popup = rst->new_popup("Global", "test");
-   test_equal("Global.test", popup, "should return identifier of popup");
-   menu_delete_item(popup);
-}
-
-% static define rst_menu(menu)
-static define test_rst_menu()
-{
-   % simple test for errors while executing, 
-   % TODO: test of functionality
-   variable popup = "Global.test";
-   menu_append_popup("Global", "test");
-   rst->rst_menu(popup);
-   menu_delete_item(popup);
-}
-
-% public define rst_mode()
-static define test_rst_mode()
-{
-   % simple test for errors while executing, 
-   % TODO: test of functionality
-   rst_mode();
-}

Deleted: jed-extra/trunk/tests/structured_text-test.sl
===================================================================
--- jed-extra/trunk/tests/structured_text-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/structured_text-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,250 +0,0 @@
-% structured_text-test.sl:  Test structured_text.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-require("unittest");
-
-% test availability of public functions (comment to skip)
-test_true(is_defined("structured_text_hook"), "public fun structured_text_hook undefined");
-
-% Fixture
-% -------
-
-require("structured_text");
-
-private variable testbuf = "*bar*";
-private variable teststring = "a test line";
-private variable enumerated_list = ["1. das ist es",
-                                    "2.  auch noch",
-                                    " 3. drittens",
-                                    "45.\tlast"];
-private variable itemize_list = ["* so",
-                                 "+ geht's",
-                                 "*  auch",
-                                 "-  nicht",
-                                 "+\tbesser"];
-
-private define insert_lists()
-{
-   insert(strjoin(enumerated_list, "\n")+"\n"+strjoin(itemize_list, "\n"));
-}
-  
-static define setup()
-{
-   sw2buf(testbuf);
-   insert(teststring);
-}
-
-static define teardown()
-{
-   sw2buf(testbuf);
-   set_buffer_modified_flag(0);
-   close_buffer(testbuf);
-}
-
-% Test functions
-% --------------
-
-% line_is_list: library function
-% 
-%  SYNOPSIS
-%   Return length of a list marker
-% 
-%  USAGE
-%    line_is_list()
-% 
-%  DESCRIPTION
-%  Check if the current line starts with a list marker matching one of the
-%  regular expressions defined in `Rst_List_Patterns'.
-%  Return length of the list marker (excluding leading whitespace)
-% 
-%  Leaves the editing point at first non-whitespace or eol
-% 
-%  NOTES
-%  Thanks to JED for the regular expressions variant
-% 
-%  SEE ALSO
-%   line_is_empty, Text_List_Patterns
-static define test_line_is_list()
-{
-   test_equal(line_is_list(), 0, "text line is no list");
-   erase_buffer();
-   insert_lists();
-   bob();
-   do
-     test_true(line_is_list(), "should recognize list line");
-   while (down_1());
-   % should return the length of the list marker:
-   bob();
-   variable len, 
-     marker_lengths = [3, %   "1. das ist es",
-                       4, %   "2.  auch noch",
-                       3, %   " 3. drittens",
-                       4, %   "45.\tlast"
-                       2, %   "* so",
-                       2, %   "+ geht's",
-                       3, %   "*  auch",
-                       3, %   "-  nicht",
-                       2]; %   "+\tbesser"              
-   
-   foreach len (marker_lengths)
-     {
-        test_equal(line_is_list(), len, 
-           sprintf("should return list marker length (%d) '%s'",  
-              len, get_line()));
-        go_down_1();
-     }
-}
-
-% define line_is_blank()
-static define test_line_is_blank()
-{
-   test_equal(line_is_blank(), 0, "text is not blank");
-   erase_buffer();
-   insert("\n   \n\t\t\n\n  \t\n\n");
-   bob();
-   do
-     test_true(line_is_blank(), sprintf("line %d is blank", what_line));
-   while (down_1());
-}
-
-% TODO: the remainder is still raw testscript_wizard output
-#stop
-
-% st_is_paragraph_separator: library function
-% 
-%  SYNOPSIS
-%   paragraph separator hook for structured text
-% 
-%  USAGE
-%   st_is_paragraph_separator()
-% 
-%  DESCRIPTION
-%  Return 1 if the current line separates a paragraph, i.e. it
-%  is empty or a list item
-% 
-%  NOTES
-%  Actually, this misses an important difference between empty lines and
-%  first lines of a list item: While an empty line must not be filled
-%  when reformatting, a list item should.
-%  This is why Emacs has 2 Variables, paragraph-separator and paragraph-start.
-% 
-%  SEE ALSO
-%   line_is_empty, line_is_list
-static define test_st_is_paragraph_separator()
-{
-   st_is_paragraph_separator();
-}
-
-% define st_backward_paragraph()
-static define test_st_backward_paragraph()
-{
-   st_backward_paragraph();
-}
-
-% define st_mark_paragraph()
-static define test_st_mark_paragraph()
-{
-   st_mark_paragraph();
-}
-
-% st_indent: library function
-% 
-%  SYNOPSIS
-%   indent-line for structured text
-% 
-%  USAGE
-%   st_indent()
-% 
-%  DESCRIPTION
-%  Indent the current line,  taking care of list markers as defined in
-%  `Text_List_Patterns'.
-% 
-%  NOTES
-%   Expanded from example in hooks.txt
-% 
-%  SEE ALSO
-%   st_is_paragraph_separator, line_is_list, Text_List_Patterns
-static define test_st_indent()
-{
-   st_indent();
-}
-
-% st_newline_and_indent: library function
-% 
-%  SYNOPSIS
-%   newline_and_indent for structured text
-% 
-%  USAGE
-%    st_newline_and_indent ()
-% 
-%  DESCRIPTION
-%  Indent to level of preceding line
-% 
-%  NOTES
-%  We need a separate definition, as by default newline_and_indent()  uses the
-%  indent_hook (which structured_text.sl sets to st_indent (considering list
-%  markers) while with Enter we want more likely to start a new list topic.
-% 
-%  SEE ALSO
-%   st_indent, st_indent_relative
-static define test_st_newline_and_indent()
-{
-   st_newline_and_indent();
-}
-
-% define st_format_paragraph();  % forward definition
-static define test_st_format_paragraph()
-{
-   st_format_paragraph();
-}
-
-% define st_format_paragraph()
-static define test_st_format_paragraph()
-{
-   st_format_paragraph();
-}
-
-% structured_text_hook: library function
-% 
-%  SYNOPSIS
-%   Formatting hook for "ASCII markup"
-% 
-%  USAGE
-%   structured_text_hook()
-% 
-%  DESCRIPTION
-%   This function calls a list of buffer hooks (see Help>Browse-Docs>Hooks)
-%   suitable for proper indenting and paragraph formatting of documents using
-%   "ASCII markup".
-%   
-%   Paragraphs are separated by blank lines and indented to the same column
-%   as the first line of the paragraph.
-%   
-%   List items that start with a special list marker (e.g. '* ' or '3.') are
-%   considered paragraphs as well, even when not preceded by an empty line.
-%   Continuation lines are indented to the column that matches the start of the
-%   list text.%  
-% 
-%  EXAMPLE
-%   To enable the structured text formatting in `text_mode', set an alias:
-% 
-%    define text_mode_hook() { structured_text_hook(); }
-% 
-% 
-%  NOTES
-%   `rst_mode' calls `structured_text_hook' by default.
-% 
-%  SEE ALSO
-%   st_indent, st_backward_paragraph, st_mark_paragraph
-static define test_structured_text_hook()
-{
-   structured_text_hook();
-}
-
-sw2buf("*test report*");
-view_mode();

Deleted: jed-extra/trunk/tests/test-browse_url.sl
===================================================================
--- jed-extra/trunk/tests/test-browse_url.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-browse_url.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,42 +0,0 @@
-% test-browse_url.sl: Test browse_url.sl with unittest.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-require("unittest");
-
-variable test_url = "http://www.example.org";
-
-% find_url(url=read_mini, cmd = Browse_Url_Download_Cmd); Find a file by URL
-%  public define find_url() %(url=read_mini, cmd = Browse_Url_Download_Cmd)
-test_function("find_url", test_url);
-test_last_result();
-test_equal(whatbuf(), test_url);
-delbuf(test_url);
-
-% view_url(Str url=read_mini, Str cmd= Browse_Url_Viewer); View an ASCII rendering of a URL
-%  public define view_url() %(url=read_mini, cmd= Browse_Url_Viewer)
-test_function("view_url", test_url);
-test_last_result();
-test_equal(whatbuf(), "*"+test_url+"*");
-delbuf("*"+test_url+"*");
-
-% public  define browse_url_x() %(url, cmd=Browse_Url_X_Browser)
-% browse_url_x(Str url=ask, Str cmd=Browse_Url_X_Browser); Open a URL in a browser
-testmessage("\n  browse_url_x() needs interactive testing,");
-testmessage("\n  (opens a document in an external browser with system())");
-%  test_function("browse_url_x", test_url);
-% test_last_result();
-%   browse_url_x(): OK ()
-
-% public define browse_url() %(url=read_mini, cmd=Browse_Url_Browser)
-% browse_url() %(url=read_mini, cmd=Browse_Url_Browser); Open the url in a browser
-testmessage("\n  browse_url() needs interactive testing,");
-testmessage("\n  (opens a document in an external browser with system())");
-% (commented out to prevent side effects)
-% test_function("browse_url", test_url);
-% test_last_result();
-%  browse_url(http://jedmodes.sourceforge.net/mode/cua/index.php): OK ()

Deleted: jed-extra/trunk/tests/test-calc.sl
===================================================================
--- jed-extra/trunk/tests/test-calc.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-calc.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,158 +0,0 @@
-% test-calc.sl: % Test calc.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 basic test for errors with call of public functions
-
-
-require("unittest");
-% private namespace: `calc'
-
-% Open the calc buffer
-
-
-% calc: library function  Undocumented
-%  public define calc ()
-test_function("calc");
-test_last_result();
-test_equal(whatbuf(), "Calculator");
-
-
-% calc2: library function  Undocumented
-%  public define calc2 ()
-test_function("calc2");
-test_last_result();
-
-% clean up and abort (TODO test remaining functions)
-sw2buf("Calculator");
-set_buffer_modified_flag(0);
-delbuf("Calculator");
-delbuf("*calcres*");
-#stop
-
-% calc_select_expression_buf: undefined  Undocumented
-%  static define calc_select_expression_buf ()
-test_function("calc->calc_select_expression_buf");
-test_last_result();
-
-% history_next: undefined  Undocumented
-%  static define history_next ()
-test_function("calc->history_next");
-test_last_result();
-
-% history_prev: undefined  Undocumented
-%  static define history_prev ()
-test_function("calc->history_prev");
-test_last_result();
-
-% calc_next_expression: undefined  Undocumented
-%  public define calc_next_expression ()
-test_function("calc_next_expression");
-test_last_result();
-
-% calc_format_binary: undefined  Undocumented
-%  static define calc_format_binary (val)
-test_function("calc->calc_format_binary");
-test_last_result();
-
-% calc_display_value: undefined  Undocumented
-%  static define calc_display_value(val, linepref);
-test_function("calc->calc_display_value");
-test_last_result();
-
-% calc_display_value: undefined  Undocumented
-%  static define calc_display_value(val, linepref)
-test_function("calc->calc_display_value");
-test_last_result();
-
-% calc_display_stack: undefined  Undocumented
-%  static define calc_display_stack ()
-test_function("calc->calc_display_stack");
-test_last_result();
-
-% calc_display_variables: undefined  Undocumented
-%  public define calc_display_variables ()
-test_function("calc_display_variables");
-test_last_result();
-
-% calc_result_window: undefined  Undocumented
-%  public define calc_result_window ()
-test_function("calc_result_window");
-test_last_result();
-
-% calc_make_calculation: undefined  Undocumented
-%  public define calc_make_calculation ()
-test_function("calc_make_calculation");
-test_last_result();
-
-% calc_find_max_id: undefined  Undocumented
-%  static define calc_find_max_id ()
-test_function("calc->calc_find_max_id");
-test_last_result();
-
-% calc_read_file: undefined  Undocumented
-%  public define calc_read_file ()
-test_function("calc_read_file");
-test_last_result();
-
-% calc_write_file: undefined  Undocumented
-%  public define calc_write_file ()
-test_function("calc_write_file");
-test_last_result();
-
-% calc_float_format: undefined  Undocumented
-%  public define calc_float_format ()
-test_function("calc_float_format");
-test_last_result();
-
-% calc_help: undefined  Undocumented
-%  public define calc_help ()
-test_function("calc_help");
-test_last_result();
-
-% calc_prepare_keymap: undefined  Undocumented
-%  static define calc_prepare_keymap ()
-test_function("calc->calc_prepare_keymap");
-test_last_result();
-
-% calc_reset_buffer: undefined  Undocumented
-%  public define calc_reset_buffer()
-test_function("calc_reset_buffer");
-test_last_result();
-
-% init_menu: undefined  Undocumented
-%  static define init_menu (menu)
-test_function("calc->init_menu");
-test_last_result();
-
-% calc_start: undefined  Undocumented
-%  static define calc_start ()
-test_function("calc->calc_start");
-test_last_result();
-
-% calc_mode_dec: undefined  Undocumented
-%  public define calc_mode_dec()
-test_function("calc_mode_dec");
-test_last_result();
-
-% calc_mode_hex: undefined  Undocumented
-%  public define calc_mode_hex()
-test_function("calc_mode_hex");
-test_last_result();
-
-% calc_mode_oct: undefined  Undocumented
-%  public define calc_mode_oct()
-test_function("calc_mode_oct");
-test_last_result();
-
-% calc_mode_bin: undefined  Undocumented
-%  public define calc_mode_bin()
-test_function("calc_mode_bin");
-test_last_result();
-
-% calc_mode_all: undefined  Undocumented
-%  public define calc_mode_all()
-test_function("calc_mode_all");
-test_last_result();

Deleted: jed-extra/trunk/tests/test-console_keys.sl
===================================================================
--- jed-extra/trunk/tests/test-console_keys.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-console_keys.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,30 +0,0 @@
-% test-console_keys.sl:  Test console_keys.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 just test evaluating the file
-
-
-require("unittest");
-
-
-
-
-test_function("evalfile", "console_keys");
-test_last_result(1);
-
-testmessage("\n  console_keys.sl needs interactive testing in a Linux console");
-#stop
-
-% define set_console_keys()
-% set_console_keys: undefined  Undocumented
-test_function("set_console_keys");
-test_last_result();
-
-% define restore_console_keys()
-% restore_console_keys: undefined  Undocumented
-test_function("restore_console_keys");
-test_last_result();
-

Deleted: jed-extra/trunk/tests/test-css1.sl
===================================================================
--- jed-extra/trunk/tests/test-css1.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-css1.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,28 +0,0 @@
-% test-css1.sl:  Test css1.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-
-require("unittest");
-
-
-sw2buf("*scratch*");
-
-
-% public define css1_mode() {
-% css1_mode: library function  Undocumented
-test_function("css1_mode");
-test_last_result();
-test_equal(get_mode_name(), "css1");
-
-no_mode();
-
-% test the automatic mode setting at loading a file
-test_function("find_file", "test.css"); % new file, empty buffer
-test_equal(get_mode_name(), "css1");
-if (bufferp("test.css"))
-  delbuf("test.css");

Deleted: jed-extra/trunk/tests/test-dict-cli.sl
===================================================================
--- jed-extra/trunk/tests/test-dict-cli.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-dict-cli.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,49 +0,0 @@
-% test-dict-cli.sl:  Test dict-cli.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-% This test requires an internet connection (to reach "dict.org") or a running
-% dictd on localhost (customize by (un)commenting the right host variable).
-% 
-% Is there a way to test the returned results?
-
-require("unittest");
-require("dict-cli");
-
-% fixture
-private variable word = "line";
-private variable host = "dict.org";    % public dict server
-% private variable host = "localhost"; % local dict server
-private variable database = "!";       % server default
-private variable strategy = ".";       % server default
-private variable what = "db";
-
-sw2buf("*scratch*");
-erase_buffer();
-while(markp())
-  pop_mark_0();
-
-% define dict_define(word, database, host)
-% dict_define: library function  Undocumented
-test_function("dict_define", word, database, host);
-test_last_result();
-erase_buffer();
-
-% define dict_match(word, strategy, database, host)
-% dict_match: library function  Undocumented
-test_function("dict_match", word, strategy, database, host);
-test_last_result();
-erase_buffer();
-
-% define dict_show(what, host)
-% dict_show: library function  Undocumented
-test_function("dict_show", what, host);
-test_last_result();
-erase_buffer();
-
-sw2buf("*test report*");
-view_mode();

Deleted: jed-extra/trunk/tests/test-dict-curl.sl
===================================================================
--- jed-extra/trunk/tests/test-dict-curl.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/test-dict-curl.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,54 +0,0 @@
-% test-dict-curl.sl:  Test dict-curl.sl
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-
-% This test requires the curl slang module as well as
-% an internet connection (to reach "dict.org") or a running
-% dictd on localhost (don't forget to customize the host variable).
-% 
-% Is there a way to test the inserted results?
-
-require("unittest");
-
-% testmessage("at my site, dict-curl crashs ('Speicherzugriffsfehler') Jed" +
-%    "Jed Version: 0.99.18, S-Lang Version: 2.0.6, slang-curl 0.1.1-5");
-% throw AssertionError, "() = evalfile(\"dict-curl\"); crashs Jed";
-
-() = evalfile("dict-curl");
-
-% fixture
-private variable word = "line";
-private variable host = "dict.org";    % public dict server
-% private variable host = "localhost"; % local dict server
-private variable database = "!";       % server default
-private variable strategy = ".";       % server default
-private variable what = "db";
-
-sw2buf("*scratch*");
-erase_buffer();
-while(markp())
-  pop_mark_0();
-
-% define dict_define(word, database, host)
-% dict_define: library function  Undocumented
-test_function("dict_define", word, database, host);test_last_result();
-erase_buffer();
-
-% define dict_match(word, strategy, database, host)
-% dict_match: library function  Undocumented
-test_function("dict_match", word, strategy, database, host);
-test_last_result();
-erase_buffer();
-
-% define dict_show(what, host)
-% dict_show: library function  Undocumented
-test_function("dict_show", what, host);
-test_last_result();
-erase_buffer();
-
-sw2buf("*test report*");
-view_mode();

Deleted: jed-extra/trunk/tests/unittesttest.sl
===================================================================
--- jed-extra/trunk/tests/unittesttest.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/unittesttest.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,178 +0,0 @@
-% unittesttest.sl: test the SLang unittest framework
-% 
-% This self-testing is quite verbose and out of line with the remaining unit
-% tests so it deliberately named not to match the "-test"
-% Unittest_File_Pattern.
-% 
-% Copyright (c) 2006 Günter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 0.1 2006-03-03 
-% 0.3 2006-09-25  * adapted to unittest version 0.3
-%                 * undo Error_Count increase in case of correct behaviour
-%                   of the test functions
-
-require("unittest");
-require("sprint_var");
-
-static variable results, err, a=1, b=3, last_error_count;
-
-
-testmessage("\n\nAssertions");
-% ----------
-
-% here, we put the AssertionError in a try-catch phrase to keep on
-% evaluating the unittest test script
-try (err)
-{
-   if (a != b)
-     throw AssertionError, "$a != $b"$;
-   % this code should not be reached:
-   testmessage("E: AssertionError not thrown ");
-   unittest->Error_Count++;
-}
-catch AssertionError:
-{
-   testmessage("OK: wrong assertion threw AssertionError.");
-}
-
-
-
-testmessage("\n\nTruth and Equality\n");
-% ------------------------------------
-
-testmessage("\ntest_true(): true args must not show in the report");
-test_true(1+1 == 2, "# 1+1 should be 2, test_true failed");
-
-last_error_count = unittest->Error_Count;
-test_true(1+1 == 3);
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: 1+1 == 3 is FALSE, so test_true() works fine");
-   unittest->Error_Count--;
-}
-
-testmessage("\ntest_equal(): this should not show in the report");
-test_equal(1+1, 2, "# test_equal failed: 1+1 should be 2");
-
-last_error_count = unittest->Error_Count;
-test_equal(1+1, 3);
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: 1+1 != 3, so test_equal() works fine");
-   unittest->Error_Count--;
-}
-
-
-testmessage("\n\nStack hygiene\n");
-% -------------------------------
-
-testmessage("\n empty stack, so there should be no response");
-test_stack();
-testmessage("\n now push 2 values on stack");
-42, "baa";
-
-last_error_count = unittest->Error_Count;
-test_stack();
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: garbage on stack detected");
-   unittest->Error_Count--;
-}
-
-testmessage("\n\ntest for exceptions:\n");
-% ----------------------------------------
-
-private define zero_division()
-{
-   return 23/0;
-}
-
-testmessage("\n non defined function:");
-err = test_for_exception("foo");
-testmessage("\n  result: %S %s", typeof(err), sprint_variable(err));
-
-testmessage("\n no exception:");
-err = test_for_exception("what_line");
-testmessage("\n  result: " + sprint_variable(err));
-
-testmessage("\n zero division:");
-err = test_for_exception(&zero_division);
-testmessage("\n  result: " + sprint_error(err));
-
-
-testmessage("\n\nFunction testing:\n");
-% -------------------------------------
-
-testmessage(" working cases");
-test_function("sprintf", "%d", 8);
-test_last_result("8");
-test_function("eval", "3+4");
-test_last_result(7);
-test_function(&bol);
-test_last_result();
-
-testmessage(" catching bugs");
-last_error_count = unittest->Error_Count;
-test_function("sprintf", "%d", 8);
-test_last_result("8");
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: catched wrong return value");
-   unittest->Error_Count--;
-}
-
-last_error_count = unittest->Error_Count;
-test_function("non_defined");
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: catched non defined function");
-   unittest->Error_Count--;
-}
-
-last_error_count = unittest->Error_Count;
-test_function("message", NULL);
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: catched wrong usage");
-   unittest->Error_Count--;
-}
-
-last_error_count = unittest->Error_Count;
-test_function("zero_division");
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: catched buggy function");
-   unittest->Error_Count--;
-}
-
-last_error_count = unittest->Error_Count;
-test_function(&what_line);
-test_last_result();
-if (unittest->Error_Count == last_error_count + 1)
-{
-   testmessage("\n OK: catched unexpected return value");
-   unittest->Error_Count--;
-}
-
-
-testmessage("\n\nRun a test script:\n");
-% ------------------------------------
-
-% () = test_file(path_concat(path_dirname(__FILE__), "datutils-test.sl"));
-% () = test_file("uffe.sl");  % not present
-
-testmessage("\n\nRun a test suite:\n");
-% ------------------------------------
-
-() = test_files("fooli/"); % invalid dir
-() = test_files("/home/milde/.jed/lib/test/*datutils*.sl");
-
-testmessage("\n\nRun a test suite and exit Jed:\n");
-% --------------------------------------------------
-
-testmessage("\n skipped");
-% () = test_files_and_exit("/home/milde/.jed/lib/test/*datutils*.sl");
-
-message("Done");

Deleted: jed-extra/trunk/tests/utf8helper-autoconvert-test.sl
===================================================================
--- jed-extra/trunk/tests/utf8helper-autoconvert-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/utf8helper-autoconvert-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,104 +0,0 @@
-%  utf8helper-test.sl:  Test utf8helper.sl
-% 
-% Copyright (c) 2006 Guenter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 1.1 2007-06-02 
-
-require("unittest");
-
-% Fixture
-% -------
-
-% Do not load here, as the hooks are only added !if (_featurep("utf8helper"))
-% require("utf8helper");
-custom_variable("UTF8Helper_Read_Autoconvert", 0);
-custom_variable("UTF8Helper_Write_Autoconvert", 0);
-
-% testbufs[_slang_utf8_ok] is in active encoding
-private variable   teststrings,
-  testbufs = ["ch_table-lat1-decimal.txt", 
-              "ch_table-utf8-decimal.txt"],
-  base_dir = path_dirname(__FILE__),
-  read_autoconvert = UTF8Helper_Read_Autoconvert,
-  write_autoconvert = UTF8Helper_Write_Autoconvert;
-
-% set the _jed_*_hooks
-UTF8Helper_Read_Autoconvert = 1;
-UTF8Helper_Write_Autoconvert = 1;
-
-% now evaluate:
-() = evalfile("utf8helper");
-
-static define setup()
-{
-   teststrings = array_map(String_Type, 
-      &strread_file, base_dir + "/" + testbufs);
-}
-
-static define teardown()
-{
-   variable buf;
-   foreach buf (testbufs)
-     {
-        !if (bufferp(buf))
-          continue;
-        sw2buf(buf);
-        set_buffer_modified_flag(0);
-        close_buffer();
-     }
-   UTF8Helper_Read_Autoconvert = read_autoconvert;
-   UTF8Helper_Write_Autoconvert = write_autoconvert;
-}
-
-% Test functions
-% --------------
-
-
-static define test_read_autoconvert()
-{
-   % do autoconvert the test buffers:
-   UTF8Helper_Read_Autoconvert = 1;
-
-   % load file in "wrong" encoding
-   () = find_file(base_dir + "/" + testbufs[not(_slang_utf8_ok)]);
-   % should autoconvert:
-   if (_slang_utf8_ok)
-     test_equal(get_blocal("encoding"), "utf8");
-   else
-     test_equal(get_blocal("encoding"), "latin1");
-   mark_buffer();
-   % testbufs[_slang_utf8_ok] is in active encoding
-   test_equal(bufsubstr(), teststrings[_slang_utf8_ok],
-      "should autoconvert to native encoding");
-}
-
-static define test_read_autoconvert_false()
-{
-   % do not autoconvert the test buffers:
-   UTF8Helper_Read_Autoconvert = 0;
-
-   % testbufs[_slang_utf8_ok] is in active encoding
-   % load file in "wrong" encoding
-   () = find_file(base_dir + "/" + testbufs[not(_slang_utf8_ok)]);
-   mark_buffer();
-   test_equal(bufsubstr(), teststrings[not(_slang_utf8_ok)],
-      "should not autoconvert to native encoding");
-}
-
-static define test_read_autoconvert_interactive()
-{
-   % do not autoconvert the test buffers:
-   UTF8Helper_Read_Autoconvert = -1;
-
-   % testbufs[_slang_utf8_ok] is in active encoding
-   % load file in "wrong" encoding
-   () = find_file(base_dir + "/" + testbufs[not(_slang_utf8_ok)]);
-   update_sans_update_hook(1);
-   flush("Press any key to continue");
-   () = getkey();
-   testmessage("\n    buffer encoding is '%S'", get_blocal("encoding"));
-   
-   
-}

Deleted: jed-extra/trunk/tests/utf8helper-test.sl
===================================================================
--- jed-extra/trunk/tests/utf8helper-test.sl	2007-12-07 10:16:34 UTC (rev 989)
+++ jed-extra/trunk/tests/utf8helper-test.sl	2007-12-07 14:58:11 UTC (rev 990)
@@ -1,153 +0,0 @@
-%  utf8helper-test.sl:  Test utf8helper.sl
-% 
-% Copyright (c) 2006 Guenter Milde
-% Released under the terms of the GNU General Public License (ver. 2 or later)
-%
-% Versions:
-% 1.1 2007-06-02 
-
-require("unittest");
-
-% test availability of public functions (comment to skip)
-test_true(is_defined("latin1_to_utf8"), "public fun latin1_to_utf8 undefined");
-test_true(is_defined("utf8_to_latin1"), "public fun utf8_to_latin1 undefined");
-test_true(is_defined("strtrans_latin1_to_utf8"), "public fun strtrans_latin1_to_utf8 undefined");
-test_true(is_defined("strtrans_utf8_to_latin1"), "public fun strtrans_utf8_to_latin1 undefined");
-
-% Fixture
-% -------
-
-require("utf8helper");
-
-% testbufs[_slang_utf8_ok] is in active encoding
-private variable testbufs = ["ch_table-lat1-decimal.txt", 
-                             "ch_table-utf8-decimal.txt"],
-  teststrings = String_Type[length(testbufs)],
-  base_dir = path_dirname(__FILE__);
-
-static define setup()
-{
-   % do not autoconvert the test buffers:
-   UTF8Helper_Read_Autoconvert = 0;
-   
-   variable i=0, buf;
-   foreach buf (testbufs)
-     {
-        % load file
-        () = find_file(base_dir + "/" + buf);
-        % extract teststring
-        mark_buffer();
-        teststrings[i] = bufsubstr();
-        i++;
-     }
-}
-
-static define teardown()
-{
-   variable buf;
-   foreach buf (testbufs)
-     {
-        sw2buf(buf);
-        set_buffer_modified_flag(0);
-        close_buffer();
-     }
-}
-
-% Test functions
-% --------------
-
-% public define latin1_to_utf8()
-static define test_latin1_to_utf8()
-{
-   % transform buffer;
-   sw2buf(testbufs[0]);
-   latin1_to_utf8();
-   test_equal(get_blocal_var("encoding"), "utf8", 
-      "should set blocal var 'encoding'");
-   mark_buffer();
-   variable str = bufsubstr();
-   test_equal(str, teststrings[1]);
-   test_unequal(str, teststrings[0]);
-}
-
-% public define utf8_to_latin1 ()
-static define test_utf8_to_latin1()
-{
-   sw2buf(testbufs[1]);
-   utf8_to_latin1();
-   test_equal(get_blocal_var("encoding"), "latin1",
-      "should set blocal var 'encoding'");
-   mark_buffer();
-   variable str = bufsubstr();
-   test_unequal(str, teststrings[1]);
-   test_equal(str, teststrings[0]);
-}
-
-% public define strtrans_latin1_to_utf8(str)
-static define test_strtrans_latin1_to_utf8()
-{
-   test_unequal(strtrans_latin1_to_utf8(teststrings[0]), teststrings[0]);
-   test_equal(strtrans_latin1_to_utf8(teststrings[0]), teststrings[1]);
-}
-
-% public define strtrans_utf8_to_latin1(str)
-static define test_strtrans_utf8_to_latin1()
-{
-   test_unequal(strtrans_latin1_to_utf8(teststrings[1]), teststrings[1]);
-   test_equal(strtrans_utf8_to_latin1(teststrings[1]), teststrings[0]);
-}
-
-% scan for non-printable characters in current buffer
-% static define has_invalid_chars()
-static define test_has_invalid_chars()
-{
-   sw2buf(testbufs[not(_slang_utf8_ok)]); % testbuffer in other encoding
-   test_true(utf8helper->has_invalid_chars());
-}
-
-static define test_has_invalid_chars_false()
-{
-   sw2buf(testbufs[_slang_utf8_ok]); % testbuffer in active encoding
-   test_equal(0, utf8helper->has_invalid_chars());
-}
-
-#stop 
-
-#if (_slang_utf8_ok)
-
-% define insert_after_char(char)
-static define test_insert_after_char()
-{
-   insert_after_char();
-}
-
-% define stroke() { insert_after_char(0x336); }
-static define test_stroke()
-{
-   stroke();
-}
-
-% define underline() { insert_after_char(0x332); }
-static define test_underline()
-{
-   underline();
-}
-
-% define double_underline() { insert_after_char(0x333); }
-static define test_double_underline()
-{
-   double_underline();
-}
-
-% define overline() { insert_after_char(0x305); }
-static define test_overline()
-{
-   overline();
-}
-
-% define double_overline() { insert_after_char(0x33f); }
-static define test_double_overline()
-{
-   double_overline();
-}
-#endif




More information about the Pkg-jed-commit mailing list