lvc / api-sanity-checker

An automatic generator of basic unit tests for a C/C++ library
https://lvc.github.io/api-sanity-checker/
GNU Lesser General Public License v2.1
85 stars 13 forks source link

spec_type options disappearing #22

Open ghost opened 9 years ago

ghost commented 9 years ago

For what is basically an implementation of strdup() I tried to apply the spectype.xml file, however the free($0) call will be cleared and never appears in the generated test code. And on that same note, neither does the additional #include <stdlib.h>. As far as I read the examples, this is what it supposed to work like, right?

<collection>
    <spec_type>
        <kind>
            normal
        </kind>
        <data_type>
            char *
        </data_type>
        <constraint>
            $0!=NULL&&strcmp($0,$1)==0
        </constraint>
        <final_code>
            free($0);
        </final_code>
        <global_code>
            free($0);
        </global_code>
        <associating>
            <interfaces>
                dup_string
            </interfaces>
            <links>
                retval
            </links>
        </associating>
    </spec_type>
    <spec_type>
        <data_type>
            const char *
        </data_type>
        <decl_code>
            const char *s = "test input";
        </decl_code>
        <associating>
            <interfaces>
                dup_string
            </interfaces>
            <links>
                param1
            </links>
        </associating>
    </spec_type>
</collection>
aponomarenko commented 8 years ago

Hello.

Thanks for reporting issues.

Could you please attach the input data and exact command line to reproduce the issue?

Thank you.