Merge lp:~mhr3/libunity/workaround-vala-bug into lp:~unity-team/libunity/libunity-7.0

Proposed by Michal Hruby
Status: Merged
Approved by: Paweł Stołowski
Approved revision: 380
Merged at revision: 380
Proposed branch: lp:~mhr3/libunity/workaround-vala-bug
Merge into: lp:~unity-team/libunity/libunity-7.0
Diff against target: 57 lines (+25/-2)
2 files modified
src/unity-aggregator-scope-private.vala (+2/-2)
test/vala/test-scope.vala (+23/-0)
To merge this branch: bzr merge lp:~mhr3/libunity/workaround-vala-bug
Reviewer Review Type Date Requested Status
Paweł Stołowski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+163126@code.launchpad.net

Commit message

Workaround a bug in Vala

Description of the change

Workaround a bug in Vala - a variable with the same name in different blocks of async method generates invalid code.

Added a test that will catch this problem in the future.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Paweł Stołowski (stolowski) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/unity-aggregator-scope-private.vala'
--- src/unity-aggregator-scope-private.vala 2013-05-08 15:09:40 +0000
+++ src/unity-aggregator-scope-private.vala 2013-05-09 10:31:25 +0000
@@ -1511,10 +1511,10 @@
1511 HashTable<string, Variant>? last_hints = last_agg_search.get_reply_hints ();1511 HashTable<string, Variant>? last_hints = last_agg_search.get_reply_hints ();
1512 if (last_hints != null)1512 if (last_hints != null)
1513 {1513 {
1514 HashTableIter<string, Variant> iter = HashTableIter<string, Variant> (last_hints);1514 var hints_iter = HashTableIter<string, Variant> (last_hints);
1515 unowned string key;1515 unowned string key;
1516 unowned Variant variant;1516 unowned Variant variant;
1517 while (iter.next (out key, out variant))1517 while (hints_iter.next (out key, out variant))
1518 response.insert (key, variant);1518 response.insert (key, variant);
1519 }1519 }
15201520
15211521
=== modified file 'test/vala/test-scope.vala'
--- test/vala/test-scope.vala 2013-04-30 16:21:16 +0000
+++ test/vala/test-scope.vala 2013-05-09 10:31:25 +0000
@@ -117,6 +117,8 @@
117 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_global_search));117 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_global_search));
118 Test.add_data_func ("/Unit/MasterScope/MultipleChannels",118 Test.add_data_func ("/Unit/MasterScope/MultipleChannels",
119 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_multiple_channels));119 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_multiple_channels));
120 Test.add_data_func ("/Unit/MasterScope/NoContentHint",
121 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_no_content));
120 Test.add_data_func ("/Unit/MasterScope/Activation",122 Test.add_data_func ("/Unit/MasterScope/Activation",
121 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_activation));123 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_activation));
122 Test.add_data_func ("/Unit/MasterScope/Sorting/Ascending",124 Test.add_data_func ("/Unit/MasterScope/Sorting/Ascending",
@@ -1087,6 +1089,27 @@
1087 assert (model.get_n_rows () > 0);1089 assert (model.get_n_rows () > 0);
1088 }1090 }
10891091
1092 public void test_master_no_content ()
1093 {
1094 const string MSG = "There's no content...";
1095 const string HINT = Unity.Internal.SEARCH_NO_RESULTS_HINT;
1096
1097 master_scope.no_content_hint = MSG;
1098 results_per_scope = 0;
1099
1100 // we need channel first
1101 Dee.SerializableModel model;
1102 var channel_id = ScopeTester.open_channel (proxy, ChannelType.DEFAULT,
1103 out model);
1104 assert (channel_id != null);
1105 var reply_dict = ScopeTester.perform_search (proxy, channel_id, "", null, model);
1106
1107 assert (search_handler_invocations == child_scopes.length);
1108 assert (reply_dict != null);
1109 assert (HINT in reply_dict);
1110 assert (reply_dict[HINT].get_string () == MSG);
1111 }
1112
1090 public void test_master_multiple_channels ()1113 public void test_master_multiple_channels ()
1091 {1114 {
1092 // we need channel first1115 // we need channel first

Subscribers

People subscribed via source and target branches

to all changes: