mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Hooks
- Added a new on-launch-misbehave2 script that emits unexpected JSON.
This commit is contained in:
parent
3cce6c23f5
commit
bd785ffad5
3 changed files with 39 additions and 3 deletions
|
@ -402,6 +402,9 @@ bool Hooks::isJSON (const std::string& input) const
|
|||
input[input.length () - 1] != '}')
|
||||
return false;
|
||||
|
||||
/*
|
||||
I think this is not necessary, and a simple JSON test is all that is needed.
|
||||
|
||||
try
|
||||
{
|
||||
json::value* root = json::parse (input);
|
||||
|
@ -419,6 +422,7 @@ bool Hooks::isJSON (const std::string& input) const
|
|||
{
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -481,11 +485,11 @@ void Hooks::assertValidJSON (const std::vector <std::string>& input) const
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Hooks::assertNTasks (const std::vector <std::string>& json, int n) const
|
||||
void Hooks::assertNTasks (const std::vector <std::string>& input, int n) const
|
||||
{
|
||||
if (json.size () != n)
|
||||
if (input.size () != n)
|
||||
{
|
||||
context.error (format ("Hook Error: Expected {1} JSON task(s), found {2}", n, (int) json.size ()));
|
||||
context.error (format ("Hook Error: Expected {1} JSON task(s), found {2}", n, (int) input.size ()));
|
||||
throw 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue