Skip to content

Replace direct ref to UT assert structure with macro #59

@jphickey

Description

@jphickey

Describe the bug
A test in sample_lib is directly referencing the ArgPtr member inside the Context object from the hook call. Since the time this was initially implemented, the Ut Assert framework has improved, and now offers a UT_Hook_GetArgValueByName macro get this value.

Directly referencing the value is not a good design and is likely to break as Ut Assert continues to evolve.

Expected behavior
This should be updated to use the preferred macro, UT_Hook_GetArgValueByName, which is more future-proof and reflects current best practice/recommendations for new tests.

Code snips

if (Context->ArgCount > 0 && strcmp(Context->ArgPtr[0], "SAMPLE_LIB_Function called, buffer=\'%s\'\n") == 0)

System observed on:
Ubuntu 20.04

Additional context
The specific thing pointed to by ArgPtr depends on how the stub was implemented, and the macro abstracts this detail to give a consistent result to the caller. This is why it is important to use the macro.

Reporter Info
Joseph Hickey, Vantage Systems, Inc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions