The Trunk: SUnit-dtl.79.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: SUnit-dtl.79.mcz

commits-2
David T. Lewis uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-dtl.79.mcz

==================== Summary ====================

Name: SUnit-dtl.79
Author: dtl
Time: 6 June 2010, 3:35:25.442 pm
UUID: e6568675-8893-4f0b-865f-be100c9c5c38
Ancestors: SUnit-ar.78

Provide TestCase>>timeout: as a mechanism for setting the timeout in images that do not support method annotations. For example, BitBltSimulationTest in package VMMaker requires a longer timeout value, but cannot use a <timeout:10> method annotation because it must be loadable in e.g. Squeak 3.8. The workaround for BilBltSimulationTest would be:

BitBltSimulationTest>>setUp
        (self respondsTo: #timeout: )
                ifTrue: [self perform: #timeout: with: 10]


=============== Diff against SUnit-ar.78 ===============

Item was added:
+ ----- Method: TestCase>>timeoutForSetUp (in category 'accessing') -----
+ timeoutForSetUp
+ "Answer the timeout to use for setUp"
+
+ | method |
+ method := self class lookupSelector: testSelector asSymbol.
+ (method pragmaAt: #timeout:) ifNotNil:[:tag| ^tag arguments first].
+ ^self defaultTimeout!

Item was changed:
  ----- Method: TestCase>>runCase (in category 'running') -----
  runCase
  "Run this TestCase. Time out if the test takes too long."
 
+ [self timeout: [self setUp]
+ after: self timeoutForSetUp.
+ self timeout: [self performTest]
+ after: self timeoutForTest]
+ ensure: [self tearDown]!
- [self timeout:[
- self setUp.
- self performTest
- ] after: self timeoutForTest] ensure:[self tearDown].!

Item was added:
+ ----- Method: TestCase>>timeout: (in category 'accessing') -----
+ timeout: seconds
+ "The timeout for a test should normally be set with a method annotation.
+ However, for tests that are expected to run in images that do not support
+ method annotations, the value may be set by setting the value from the
+ #setUp method (i.e. prior to running the test method)."
+
+ timeout := seconds!

Item was changed:
  Object subclass: #TestCase
+ instanceVariableNames: 'testSelector timeout'
- instanceVariableNames: 'testSelector'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'SUnit-Kernel'!
  TestCase class
  instanceVariableNames: 'history'!
 
  !TestCase commentStamp: '<historical>' prior: 0!
  A TestCase is a Command representing the future running of a test case. Create one with the class method #selector: aSymbol, passing the name of the method to be run when the test case runs.
 
  When you discover a new fixture, subclass TestCase, declare instance variables for the objects in the fixture, override #setUp to initialize the variables, and possibly override# tearDown to deallocate any external resources allocated in #setUp.
 
  When you are writing a test case method, send #assert: aBoolean when you want to check for an expected value. For example, you might say "self assert: socket isOpen" to test whether or not a socket is open at a point in a test.!
  TestCase class
  instanceVariableNames: 'history'!

Item was changed:
  ----- Method: TestCase>>timeoutForTest (in category 'accessing') -----
  timeoutForTest
  "Answer the timeout to use for this test"
 
  | method |
  method := self class lookupSelector: testSelector asSymbol.
  (method pragmaAt: #timeout:) ifNotNil:[:tag| ^tag arguments first].
+ ^timeout ifNil: [self defaultTimeout]!
- ^self defaultTimeout!