diff --git a/test/test_framework_test.go b/test/test_framework_test.go index bce75451..c0a4018c 100644 --- a/test/test_framework_test.go +++ b/test/test_framework_test.go @@ -3116,6 +3116,19 @@ func TestRetrieveLogsFromIntegrationTests(t *testing.T) { let result = blockchain.executeTransaction(tx) assert(result.status == Test.ResultStatus.succeeded) } + + pub fun tearDown() { + let expectedLogs = [ + "init successful", + "getIntegerTrait works", + "specialNumbers updated", + "addSpecialNumber works" + ] + + for log in blockchain.logs() { + Test.assert(expectedLogs.contains(log)) + } + } ` const transactionCode = ` @@ -3152,18 +3165,6 @@ func TestRetrieveLogsFromIntegrationTests(t *testing.T) { _, err := runner.RunTests(testCode) require.NoError(t, err) - - logs := runner.backend.Logs() - assert.ElementsMatch( - t, - []string{ - "init successful", - "getIntegerTrait works", - "specialNumbers updated", - "addSpecialNumber works", - }, - logs, - ) } func TestRetrieveEmptyLogsFromIntegrationTests(t *testing.T) { @@ -3251,6 +3252,10 @@ func TestRetrieveEmptyLogsFromIntegrationTests(t *testing.T) { let result = blockchain.executeTransaction(tx) assert(result.status == Test.ResultStatus.succeeded) } + + pub fun tearDown() { + Test.assert(blockchain.logs() == []) + } ` const transactionCode = ` @@ -3286,7 +3291,4 @@ func TestRetrieveEmptyLogsFromIntegrationTests(t *testing.T) { _, err := runner.RunTests(testCode) require.NoError(t, err) - - logs := runner.backend.Logs() - assert.Equal(t, []string{}, logs) } diff --git a/test/test_runner.go b/test/test_runner.go index 8757eaac..ee3a1ab4 100644 --- a/test/test_runner.go +++ b/test/test_runner.go @@ -127,8 +127,6 @@ type TestRunner struct { // the script environment, in order to aggregate and expose // log messages from test cases and contracts. logCollection *LogCollectionHook - - backend *EmulatorBackend } func NewTestRunner() *TestRunner { @@ -427,14 +425,14 @@ func (r *TestRunner) interpreterContractValueHandler( return contract case stdlib.TestContractLocation: - r.backend = NewEmulatorBackend( + testFramework := NewEmulatorBackend( r.fileResolver, stdlibHandler, r.coverageReport, ) contract, err := stdlib.NewTestContract( inter, - r.backend, + testFramework, constructorGenerator(common.Address{}), invocationRange, )