Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 807dc5cfff258d3b4288a7afd0575e5e9ad24df76af0270fdce01fc12b2811de
Ticket: 3cff6841c6b8b7af6f3d15dec74b626f557024ab
Small bug regarding -body/-returnCodes
User & Date: arjenmarkus on 2018-01-02 09:21:28
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    I am trying to use the -returnCodes option to test that a command is returning proper error codes if it is invoked with incorrect arguments. However, if I use -returnCodes, I cannot use -body to indicate the script.
    
    Here is a small script that illustrates the issue:
    
    # chktest.tcl --
    #     Check a strange phenomenon with tcltest
    #
    set version [package require tcltest]
    puts "Version tcltest: $version"
    namespace import ::tcltest::*
    
    test returncode-1.0 "Return an error code" {
        return -code 1 "Error"
    } -returnCodes 1
    
    test returncode-1.1 "Return an error code" -body {
        return -code 1 "Error"
    } -returnCodes 1
    
    The first test will succeed, whereas the second does not:
    
    Version tcltest: 2.4.0
    
    
    ==== returncode-1.1 Return an error code FAILED
    ==== Contents of test case:
    
        return -code 1 "Error"
    
    ---- Test generated return exception; Return code was: 2
    ---- Return code should have been one of: 1
    ==== returncode-1.1 FAILED
    
  5. foundin changed to: "2.4.0"
  6. is_private changed to: "0"
  7. login: "arjenmarkus"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "b4dd46eb62d921721c0aeef91d8d6e06aaeb6646"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "arjenmarkus"
  14. subsystem changed to: "34. tcltest Package"
  15. title changed to: "Small bug regarding -body/-returnCodes"
  16. type changed to: "Bug"