useocl / use

Home of the UML-based Specification Environment (USE)
GNU General Public License v2.0
43 stars 18 forks source link

Postconditions of query oparations using `result` fail to evaluate #79

Closed h-man2 closed 5 months ago

h-man2 commented 5 months ago

Describe the bug If a postcondition defined for a query operation uses the keyword result to check the result of the query operation, the evaluation fails.

To Reproduce Load the following USE-model:

model PostConditionFailure

class A
  operations
    foo():String = 'A static string'
      post postConditionValid: result = 'A static string'
      post postAlwaysInvalid: result = 'Something else'
end

Afterwards execute the follwing commands:

!create a:A
?a.foo()

USE will not complain about the invalid postcondition. Instead it will output -> 'A static string' : String.

Expected behavior USE must report the violation of the postcondition.

Additional context Currently, the evaluation of the postcondition raises an exception which is silently catched and ignored. See: MSystem::exitQueryOperation(...)