From 6d7070c1b5b63672aecc4622a5d7424f2c43c844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Fri, 8 Dec 2023 19:55:48 +0100 Subject: [PATCH 1/3] Add test to check when the log debugger stack to file setting is false, a Pharo log file is not created when requesting a debugger --- .../StDebuggerTest.class.st | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st index 0fb53497..e99508f3 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st @@ -506,6 +506,32 @@ StDebuggerTest >> testDebuggerApplication [ identicalTo: StDebugger currentApplication ] +{ #category : 'tests - session' } +StDebuggerTest >> testDebuggerDoesNotLogStackToFileSetting [ + + | logFileRef debuggingStackToFile | + + logFileRef := Smalltalk logFileName asFileReference. + logFileRef ensureDelete. + self deny: logFileRef exists. + debuggingStackToFile := session class logDebuggerStackToFile. + + debugger := StTestDebuggerProvider new debuggerWithDNUContext. + session := debugger session. + session class logDebuggerStackToFile: false. + debugger + application: debugger class currentApplication; + initialize; + open. + + self deny: debuggingStackToFile. + self + assert: logFileRef exists not + description: 'It tests that when the log debugger stack to file setting is false, a Pharo log file is not created when requesting a debugger'. + + session class logDebuggerStackToFile: debuggingStackToFile +] + { #category : 'tests - code pane' } StDebuggerTest >> testDiscardCodeChangesFor [ | firstContext lastContext | From 228d41515b4ea8925a8c01c02aeee4267df78fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Fri, 8 Dec 2023 20:09:52 +0100 Subject: [PATCH 2/3] Remove non-sense assertion --- src/NewTools-Debugger-Tests/StDebuggerTest.class.st | 1 - 1 file changed, 1 deletion(-) diff --git a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st index e99508f3..4b7ddf68 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st @@ -524,7 +524,6 @@ StDebuggerTest >> testDebuggerDoesNotLogStackToFileSetting [ initialize; open. - self deny: debuggingStackToFile. self assert: logFileRef exists not description: 'It tests that when the log debugger stack to file setting is false, a Pharo log file is not created when requesting a debugger'. From ee5d8e8d7749c618e2ef4603d3757215d5d46f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Morales=20Durand?= Date: Fri, 19 Jan 2024 15:08:52 +0100 Subject: [PATCH 3/3] Update to ensure set back the debuggingStackToFile setting if test fail, as suggested by @adri09070 --- .../StDebuggerTest.class.st | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st index a0277470..822e5b44 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerTest.class.st @@ -567,21 +567,20 @@ StDebuggerTest >> testDebuggerDoesNotLogStackToFileSetting [ logFileRef := Smalltalk logFileName asFileReference. logFileRef ensureDelete. self deny: logFileRef exists. - debuggingStackToFile := session class logDebuggerStackToFile. - - debugger := StTestDebuggerProvider new debuggerWithDNUContext. - session := debugger session. - session class logDebuggerStackToFile: false. - debugger - application: debugger class currentApplication; - initialize; - open. - - self - assert: logFileRef exists not - description: 'It tests that when the log debugger stack to file setting is false, a Pharo log file is not created when requesting a debugger'. - - session class logDebuggerStackToFile: debuggingStackToFile + debuggingStackToFile := session class logDebuggerStackToFile. + [ + debugger := StTestDebuggerProvider new debuggerWithDNUContext. + session := debugger session. + session class logDebuggerStackToFile: false. + debugger + application: debugger class currentApplication; + initialize; + open. + + self + assert: logFileRef exists not + description: 'It tests that when the log debugger stack to file setting is false, a Pharo log file is not created when requesting a debugger' ] + ensure: [ session class logDebuggerStackToFile: debuggingStackToFile ] ] { #category : 'tests - code pane' }