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
1=== modified file 'src/unity-aggregator-scope-private.vala'
2--- src/unity-aggregator-scope-private.vala 2013-05-08 15:09:40 +0000
3+++ src/unity-aggregator-scope-private.vala 2013-05-09 10:31:25 +0000
4@@ -1511,10 +1511,10 @@
5 HashTable<string, Variant>? last_hints = last_agg_search.get_reply_hints ();
6 if (last_hints != null)
7 {
8- HashTableIter<string, Variant> iter = HashTableIter<string, Variant> (last_hints);
9+ var hints_iter = HashTableIter<string, Variant> (last_hints);
10 unowned string key;
11 unowned Variant variant;
12- while (iter.next (out key, out variant))
13+ while (hints_iter.next (out key, out variant))
14 response.insert (key, variant);
15 }
16
17
18=== modified file 'test/vala/test-scope.vala'
19--- test/vala/test-scope.vala 2013-04-30 16:21:16 +0000
20+++ test/vala/test-scope.vala 2013-05-09 10:31:25 +0000
21@@ -117,6 +117,8 @@
22 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_global_search));
23 Test.add_data_func ("/Unit/MasterScope/MultipleChannels",
24 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_multiple_channels));
25+ Test.add_data_func ("/Unit/MasterScope/NoContentHint",
26+ Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_no_content));
27 Test.add_data_func ("/Unit/MasterScope/Activation",
28 Fixture.create<MasterScopeTester> (MasterScopeTester.test_master_activation));
29 Test.add_data_func ("/Unit/MasterScope/Sorting/Ascending",
30@@ -1087,6 +1089,27 @@
31 assert (model.get_n_rows () > 0);
32 }
33
34+ public void test_master_no_content ()
35+ {
36+ const string MSG = "There's no content...";
37+ const string HINT = Unity.Internal.SEARCH_NO_RESULTS_HINT;
38+
39+ master_scope.no_content_hint = MSG;
40+ results_per_scope = 0;
41+
42+ // we need channel first
43+ Dee.SerializableModel model;
44+ var channel_id = ScopeTester.open_channel (proxy, ChannelType.DEFAULT,
45+ out model);
46+ assert (channel_id != null);
47+ var reply_dict = ScopeTester.perform_search (proxy, channel_id, "", null, model);
48+
49+ assert (search_handler_invocations == child_scopes.length);
50+ assert (reply_dict != null);
51+ assert (HINT in reply_dict);
52+ assert (reply_dict[HINT].get_string () == MSG);
53+ }
54+
55 public void test_master_multiple_channels ()
56 {
57 // we need channel first

Subscribers

People subscribed via source and target branches

to all changes: