Check-in [a4245ab3df]
Overview
Comment:Updated to include a more reliable test for "mkdir"
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a4245ab3dfdf5ff83743c438a53ee834c741e49c
User & Date: rkeene on 2014-06-17 16:42:38
Other Links: manifest | tags
Context
2014-06-17
16:56
Updated to treat NULL return values as errors from most types of return types check-in: fbca0aea0c user: rkeene tags: trunk
16:42
Updated to include a more reliable test for "mkdir" check-in: a4245ab3df user: rkeene tags: trunk
05:26
tcc4tcl 0.19 check-in: 3c95a2ab7e user: rkeene tags: trunk, 0.19
Changes

Modified test from [7d8a169a15] to [e33a20cdc2].

    15     15   # This should work
    16     16   tcc4tcl::cproc test3 {int i} int { return(i+42); }
    17     17   
    18     18   # Multiple arguments
    19     19   tcc4tcl::cproc add {int a int b} int { return(a+b); }
    20     20   
    21     21   # Add external functions
    22         -tcc4tcl::cproc mkdir {char* dir} ok {
    23         -	int rv;
           22  +tcc4tcl::cproc mkdir {Tcl_Interp* interp char* dir} ok {
           23  +	int mkdir_ret;
           24  +	mkdir_ret = mkdir(dir);
    24     25   
    25         -	rv = mkdir(dir);
    26         -	if (rv == 0) {
    27         -		return(TCL_OK);
           26  +	if (mkdir_ret != 0) {
           27  +		Tcl_SetObjResult(interp, Tcl_NewStringObj("failed", -1));
           28  +		return(TCL_ERROR);
    28     29   	};
    29         -
    30         -	return(TCL_ERROR);
           30  +	return(TCL_OK);
    31     31   }
    32     32   
    33     33   
    34     34   puts [test 1]
    35     35   puts [test1 1]
    36     36   puts [test3 1]
    37     37   puts [::bob::test1 1]
    38     38   puts [add [test 1] 1]
    39     39   
    40     40   catch {
    41     41   	puts [mkdir "/"]
    42     42   } err
    43         -if {$err != ""} {
           43  +if {$err != "failed"} {
    44     44   	error "\[mkdir\] did not return the expected error"
    45     45   }