]> git.pld-linux.org Git - packages/geary.git/blame - geary-non-null.patch
- updated to 43.0; moved to libsoup3/gtk-webkit4.1
[packages/geary.git] / geary-non-null.patch
CommitLineData
b177ebfc
JB
1From 10f9c133a2ad515127d65f3bba13a0d91b75f4af Mon Sep 17 00:00:00 2001
2From: Rico Tzschichholz <ricotz@ubuntu.com>
3Date: Fri, 14 Apr 2023 09:42:23 +0200
4Subject: [PATCH] vala-unit: Fix non-null build with newer vala
5
6---
7 .../vala-unit/src/collection-assertions.vala | 12 ++++++------
8 subprojects/vala-unit/src/mock-object.vala | 6 +++---
9 subprojects/vala-unit/src/test-assertions.vala | 18 +++++++++---------
10 3 files changed, 18 insertions(+), 18 deletions(-)
11
12diff --git a/subprojects/vala-unit/src/collection-assertions.vala b/subprojects/vala-unit/src/collection-assertions.vala
13index 3b34acda1..29223a0d4 100644
14--- a/subprojects/vala-unit/src/collection-assertions.vala
15+++ b/subprojects/vala-unit/src/collection-assertions.vala
16@@ -256,7 +256,7 @@ internal class ValaUnit.ArrayCollectionAssertion<E> : GLib.Object,
17
18 public CollectionAssertions<E> contains(E expected)
19 throws GLib.Error {
20- E boxed_expected = box_value(expected);
21+ E? boxed_expected = box_value(expected);
22 bool found = false;
23 for (int i = 0; i < this.actual.length; i++) {
24 try {
25@@ -281,7 +281,7 @@ internal class ValaUnit.ArrayCollectionAssertion<E> : GLib.Object,
26
27 public CollectionAssertions<E> not_contains(E expected)
28 throws GLib.Error {
29- E boxed_expected = box_value(expected);
30+ E? boxed_expected = box_value(expected);
31 for (int i = 0; i < this.actual.length; i++) {
32 try {
33 assert_equal(box_value(this.actual[i]), boxed_expected);
34@@ -312,8 +312,8 @@ internal class ValaUnit.ArrayCollectionAssertion<E> : GLib.Object,
35 this.context
36 );
37 }
38- E boxed_actual = box_value(this.actual[index]);
39- E boxed_expected = box_value(expected);
40+ E? boxed_actual = box_value(this.actual[index]);
41+ E? boxed_expected = box_value(expected);
42 try {
43 assert_equal(boxed_actual, boxed_expected);
44 } catch (TestError.FAILED err) {
45@@ -453,8 +453,8 @@ internal class ValaUnit.GeeCollectionAssertion<E> :
46 for (int i = 0; i <= index; i++) {
47 iterator.next();
48 }
49- E boxed_actual = box_value(iterator.get());
50- E boxed_expected = box_value(expected);
51+ E? boxed_actual = box_value(iterator.get());
52+ E? boxed_expected = box_value(expected);
53 try {
54 assert_equal(boxed_actual, boxed_expected);
55 } catch (TestError.FAILED err) {
56diff --git a/subprojects/vala-unit/src/mock-object.vala b/subprojects/vala-unit/src/mock-object.vala
57index 766777a43..eb086e10c 100644
58--- a/subprojects/vala-unit/src/mock-object.vala
59+++ b/subprojects/vala-unit/src/mock-object.vala
60@@ -138,7 +138,7 @@ public interface ValaUnit.MockObject : GLib.Object, TestAssertions {
61 throws GLib.Error {
62 assert_false(this.expected.is_empty, "Unexpected call: %s".printf(name));
63
64- ExpectedCall expected = this.expected.poll();
65+ ExpectedCall expected = (!) this.expected.poll();
66 assert_equal(name, expected.name, "Unexpected call");
67 if (expected.expected_args != null) {
68 assert_args(args, expected.expected_args, "Call %s".printf(name));
69@@ -229,7 +229,7 @@ public interface ValaUnit.MockObject : GLib.Object, TestAssertions {
70 R default_return)
71 throws GLib.Error {
72 check_for_exception(expected);
73- R? return_object = default_return;
74+ R return_object = default_return;
75 if (expected.return_object != null) {
76 return_object = (R) expected.return_object;
77 }
78@@ -243,7 +243,7 @@ public interface ValaUnit.MockObject : GLib.Object, TestAssertions {
79 if (expected.return_object == null) {
80 throw default_error;
81 }
82- return expected.return_object;
83+ return (!) expected.return_object;
84 }
85
86 private inline void check_for_exception(ExpectedCall expected)
87diff --git a/subprojects/vala-unit/src/test-assertions.vala b/subprojects/vala-unit/src/test-assertions.vala
88index 784dd9fdd..e61fdf82d 100644
89--- a/subprojects/vala-unit/src/test-assertions.vala
90+++ b/subprojects/vala-unit/src/test-assertions.vala
91@@ -21,8 +21,8 @@ namespace ValaUnit {
92
93 }
94
95- internal inline void assert_equal<T>(T actual,
96- T expected,
97+ internal inline void assert_equal<T>(T? actual,
98+ T? expected,
99 string? context = null)
100 throws TestError {
101 if ((actual == null && expected != null) ||
102@@ -107,9 +107,9 @@ namespace ValaUnit {
103 *
104 * This will only work when the values are not already boxed.
105 */
106- internal T box_value<T>(T value) {
107+ internal T? box_value<T>(T value) {
108 var type = typeof(T);
109- T boxed = value;
110+ T? boxed = value;
111
112 if (type == typeof(int) || type.is_enum()) {
113 int actual = (int) value;
114@@ -133,7 +133,7 @@ namespace ValaUnit {
115 return boxed;
116 }
117
118- internal string to_display_string<T>(T value) {
119+ internal string to_display_string<T>(T? value) {
120 var type = typeof(T);
121 var display = "";
122
123@@ -191,8 +191,8 @@ namespace ValaUnit {
124 );
125 }
126
127- private void assert_equal_enum<T>(T actual,
128- T expected,
129+ private void assert_equal_enum<T>(T? actual,
130+ T? expected,
131 string? context)
132 throws TestError {
133 int actual_val = (int) ((int?) actual);
134@@ -342,7 +342,7 @@ public interface ValaUnit.TestAssertions : GLib.Object {
135
136
137 /** Asserts a value is null */
138- public void assert_non_null<T>(T actual, string? context = null)
139+ public void assert_non_null<T>(T? actual, string? context = null)
140 throws TestError {
141 if (actual == null) {
142 ValaUnit.assert(
143@@ -353,7 +353,7 @@ public interface ValaUnit.TestAssertions : GLib.Object {
144 }
145
146 /** Asserts a value is null */
147- public void assert_is_null<T>(T actual, string? context = null)
148+ public void assert_is_null<T>(T? actual, string? context = null)
149 throws TestError {
150 if (actual != null) {
151 ValaUnit.assert(
152--
153GitLab
154
This page took 0.107473 seconds and 4 git commands to generate.