theY4Kman / pysmx

Python package to interact with SourceMod plug-ins
https://pypi.org/project/pysmx
19 stars 3 forks source link

Docstring testing in SP files #3

Open theY4Kman opened 8 years ago

theY4Kman commented 8 years ago

It would be neat to write a pytest plug-in which automatically extracts tests written alongside actual SourcePawn code. This would be a very viable option for plug-in authors to begin testing. Perhaps something like this:

// STYLE A
/// @assert Negate(False)
/// @assert not Negate(True)
public Negate(thing) {
    return !thing;
}

// STYLE B -- more py.test/go test like: 
#ifdef TEST
public bool:TestMyStuff() {
    return MyStuff() == 12;
}
#endif
jaredballou commented 8 years ago

I was just talking to Psytronic about this. I'd really like to see better documentation and test functionality in SourceMod, my guess is we'd want to coordinate with the main project on the format and syntax of this.