tests/VDBVariableObjectTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 23 Jul 2019 14:53:07 +0100
changeset 181 d220862ec65f
parent 178 5d1c3e5fab6b
permissions -rw-r--r--
Remove launcher script on UNIX ...ie., `vdb` is the real executable, not just a script that launches it. Time have shown this laucnher script is not needed.

"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
"{ Package: 'jv:vdb/tests' }"

"{ NameSpace: Smalltalk }"

GDBDebuggerTestCase subclass:#VDBVariableObjectTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'VDB-Core-Tests'
!

!VDBVariableObjectTests class methodsFor:'documentation'!

copyright
"
jv:vdb - Visual / VM Debugger
Copyright (C) 2015-now Jan Vrany

This software is licensed under 'Creative Commons Attribution-NonCommercial 4.0 International License'

You may find a full license text in LICENSE.txt or at http://creativecommons.org/licenses/by-nc/4.0/
"
! !

!VDBVariableObjectTests methodsFor:'running'!

setUp
    super setUp.
    debugger pythonImportVDB.

    "Created: / 06-07-2019 / 01:20:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 08-07-2019 / 13:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!VDBVariableObjectTests methodsFor:'tests'!

test_variables_01a
    | stack varobj |

    debugger executable: GDBDebuggeesResource current binaryFactorial1.
    self assert: debugger breakpoints isEmpty.

    debugger send: 'source ', ((Smalltalk getPackageDirectoryForPackage:GDBDebuggeesResource package)
            / 'c' / 'py-framedecorator.py') pathName.
    debugger enableFrameFilters.
    debugger send: 'b factorial'.
    debugger send: 'r' andWaitFor: GDBStoppedEvent.
    stack := debugger selectedInferior threads first stack.

    varobj := VDBVariableObject evaluate: 'syntheticArg0'  in: stack first using: debugger. 

    self assert: varobj expression = 'syntheticArg0'.
    self assert: varobj value = '12'.
    self assert: varobj type = 'long long'.

    "
    VDBFrameApplication new
        debugger: debugger;
        frame: stack first;
        open.
    "
    debugger send: 'quit' andWait: false.

    "Created: / 06-07-2019 / 01:23:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 08-07-2019 / 13:29:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_variables_02a
    "
    Test #duplicate
    "
    | c1 c1_cdr c1_cdr_d  c1_cdr_d_cdr c1_cdr_d_cdr_d |

    debugger executable: GDBDebuggeesResource current binaryPyVarobj.
    self assert: debugger breakpoints isEmpty.

    debugger send: 'source ', ((Smalltalk getPackageDirectoryForPackage:GDBDebuggeesResource package)
            / 'c' / 'py-varobj.py') pathName.
    debugger enablePrettyPrinting.
    debugger send: 'b py-varobj.c:22'.
    debugger send: 'r' andWaitFor: GDBStoppedEvent.

    c1 := VDBVariableObject evaluate: '&c1'  in: debugger selectedInferior threads first stack first using: debugger.   
    self assert: c1 isDynamic.
    self assert: c1 path = '&c1'.

    c1_cdr := c1 children second.
    self assert: c1_cdr expression = 'cdr'.
    self assert: c1_cdr isDynamic.
    self assert: c1_cdr parent == c1.

    c1_cdr_d := c1_cdr duplicate.
    self assert: c1_cdr_d ~= c1_cdr.
    self assert: c1_cdr_d parent ~= c1_cdr parent.

    c1_cdr_d_cdr := c1_cdr_d children second.
    self assert: c1_cdr_d_cdr expression = 'cdr'.
    self assert: c1_cdr_d_cdr isDynamic.
    self assert: c1_cdr_d_cdr parent == c1_cdr_d
.
    c1_cdr_d_cdr_d := c1_cdr_d_cdr duplicate.
    self assert: c1_cdr_d_cdr_d ~= c1_cdr_d_cdr.
    self assert: c1_cdr_d_cdr_d parent ~= c1_cdr_d_cdr parent.

    debugger send: 'quit' andWait: false.

    "Created: / 08-07-2019 / 15:38:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified (comment): / 08-07-2019 / 16:53:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !