-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parser tests using multi-words #9
Add parser tests using multi-words #9
Conversation
Thanks, this looks alright, I just noticed that for some reason some unrelated graphics rendering tests are failing so I will just give a check on that. Specifically on this pr
So it doesn't need adventuregamestudio/ags#2443 to pass here? |
Thanks, no it doesn't need that new PR at the moment; I have written some extra tests after I found that bug though, should I add them here now or wait until the fix PR gets merged to ags master? |
It makes sense to add new tests right away, if they fail that would be also useful, that's what tests are for :). |
Ok no problem, I added the test that adventuregamestudio/ags#2443 fixes. |
@mausimus I merged mostly because I was curious to see this running in you PR, but now I notice I don't understand a specific void TestParserSaid(const string saidWords, const string inputText, int expectedResult)
{
Parser.ParseText(inputText);
String testName = String.Format("TestParserSaid: Said() '%s' with ParseText() '%s' should be %d", saidWords, inputText, expectedResult);
if(expectedResult)
tap.ok(Parser.Said(saidWords), testName);
else
tap.nok(Parser.Said(saidWords), testName);
// test with extra content at the end
String extendedWords = String.Format("%s rol", saidWords);
String extendedText = String.Format("%s please", inputText);
Parser.ParseText(extendedText);
testName = String.Format("TestParserSaid: Said() '%s' with ParseText() '%s' should be %d", extendedWords, extendedText, expectedResult);
if(expectedResult)
tap.ok(Parser.Said(extendedWords), testName);
else
tap.nok(Parser.Said(extendedWords), testName);
} |
Sure, I added this "extended" pass to make sure there's no difference if the words are at the end of the input or not (I've found some issues relating to parsing at the very end of the input earlier on), so it just adds "rol" to the pattern and "please" ignored word to the input, which shouldn't have any impact on the parsing result. |
I've added a range of tests for using multi-words in the parser; apologies if it looks a bit overkill but I think the issues around the parsing function we've recently found warrant a comprehensive approach. These tests need current master to fully pass.