1/* 2 * Copyright 2001-2011 Artima, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.scalatest 17 18import org.scalatest.fixture._ 19import org.scalatest.prop.TableDrivenPropertyChecks 20 21class InfoInsideTestFiredAfterTestProp extends SuiteProp { 22 23 test("When info appears in the code of a successful test, it should be reported after the TestSucceeded.") { 24 forAll (examples) { suite => 25 val (infoProvidedIndex, testStartingIndex, testSucceededIndex) = 26 getIndexesForInformerEventOrderTests(suite, suite.testName, suite.msg) 27 testSucceededIndex should be < infoProvidedIndex 28 } 29 } 30 31 trait Services { 32 val msg = "hi there, dude" 33 val testName = "test name" 34 } 35 36 type FixtureServices = Services 37 38 def funSuite = 39 new FunSuite with Services { 40 test(testName) { 41 info(msg) 42 } 43 } 44 45 def fixtureFunSuite = 46 new StringFixtureFunSuite with Services { 47 test(testName) { s => 48 info(msg) 49 } 50 } 51 52 def spec = 53 new Spec with Services { 54 it(testName) { 55 info(msg) 56 } 57 } 58 59 def fixtureSpec = 60 new StringFixtureSpec with Services { 61 it(testName) { s => 62 info(msg) 63 } 64 } 65} 66