+diag "send query with not quoted negative number";
+{
+ my $response = $agent->get($url."Search/Build.html?Query=Priority%20>%20-2");
+ ok( $response->is_success, "Fetched " . $url."Search/Build.html" );
+
+ is( getQueryFromForm,
+ "Priority > -2",
+ "query is the same"
+ );
+}
+
+diag "click advanced, enter an invalid SQL IS restriction, apply and check that we corrected it";
+{
+ my $response = $agent->get($url."Search/Edit.html");
+ ok( $response->is_success, "Fetched /Search/Edit.html" );
+ ok($agent->form_number(3), "found the form");
+ $agent->field("Query", "Requestor.EmailAddress IS 'FOOBAR'");
+ $agent->submit;
+ is( getQueryFromForm($agent),
+ "Requestor.EmailAddress IS NULL",
+ "foobar is replaced by NULL"
+ );
+}
+
+diag "click advanced, enter an invalid SQL IS NOT restriction, apply and check that we corrected it";
+{
+ my $response = $agent->get($url."Search/Edit.html");
+ ok( $response->is_success, "Fetched /Search/Edit.html" );
+ ok($agent->form_number(3), "found the form");
+ $agent->field("Query", "Requestor.EmailAddress IS NOT 'FOOBAR'");
+ $agent->submit;
+ is( getQueryFromForm($agent),
+ "Requestor.EmailAddress IS NOT NULL",
+ "foobar is replaced by NULL"
+ );
+}
+