banshee r4387 - in trunk/banshee: . src/Libraries/Hyena/Hyena.Query src/Libraries/Hyena/Hyena.Query/Tests
- From: blorentz svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r4387 - in trunk/banshee: . src/Libraries/Hyena/Hyena.Query src/Libraries/Hyena/Hyena.Query/Tests
- Date: Sat, 16 Aug 2008 10:47:38 +0000 (UTC)
Author: blorentz
Date: Sat Aug 16 10:47:38 2008
New Revision: 4387
URL: http://svn.gnome.org/viewvc/banshee?rev=4387&view=rev
Log:
2008-08-16 Bertrand Lorentz <bertrand lorentz gmail com>
* src/Libraries/Hyena/Hyena.Query/UserQueryParser.cs: Fix handling of
special characters in quotes (BGO #547078).
* src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs: Unit test for
the above bug, written by Sandy Armstrong and modified by me.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Query/UserQueryParser.cs
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/Tests/QueryTests.cs Sat Aug 16 10:47:38 2008
@@ -147,6 +147,18 @@
MimeTypeField.ToSql (StringQueryValue.Contains, val)
);
}
+
+ [Test]
+ // Test behavior issues described in
+ // http://bugzilla.gnome.org/show_bug.cgi?id=547078
+ public void ParenthesesInQuotes ()
+ {
+ string query = "artist==\"foo (disc 2)\"";
+
+ QueryNode query_tree = UserQueryParser.Parse (query, FieldSet);
+ Assert.IsNotNull (query_tree, "Query should parse");
+ Assert.AreEqual ("by==\"foo (disc 2)\"", query_tree.ToUserQuery ());
+ }
private static void UserQueryParsesAndGenerates (string query)
{
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Query/UserQueryParser.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Query/UserQueryParser.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Query/UserQueryParser.cs Sat Aug 16 10:47:38 2008
@@ -216,9 +216,9 @@
// TODO: Allow white space before/after term operators
- private bool IsStringTerminationChar (char ch, bool allow_whitespace)
+ private bool IsStringTerminationChar (char ch)
{
- return (!allow_whitespace && Char.IsWhiteSpace (ch)) || ch == '(' || ch == ')' || ch == '|' || ch == ',';
+ return Char.IsWhiteSpace (ch) || ch == '(' || ch == ')' || ch == '|' || ch == ',';
}
private string ScanString ()
@@ -227,7 +227,7 @@
bool in_string = false;
while (true) {
- if (IsStringTerminationChar (peek, in_string)) {
+ if (!in_string && IsStringTerminationChar (peek)) {
break;
} else if (peek == '"') {
in_string = !in_string;
@@ -241,7 +241,7 @@
ReadChar ();
if (reader.EndOfStream) {
- if (!IsStringTerminationChar (peek, false) && peek != '"') {
+ if (!IsStringTerminationChar (peek) && peek != '"') {
buffer.Append (peek);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]