summaryrefslogtreecommitdiff
path: root/tests/nonnull.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/nonnull.c')
-rw-r--r--tests/nonnull.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/nonnull.c b/tests/nonnull.c
new file mode 100644
index 0000000..d795c00
--- /dev/null
+++ b/tests/nonnull.c
@@ -0,0 +1,31 @@
+/*
+ * No error
+ */
+{
+ guint64 size = g_ascii_strtoull ("some-constant-string", NULL, 10);
+}
+
+/*
+ * No error
+ */
+{
+ const gchar *some_str = "foo";
+ guint64 size = g_ascii_strtoull (some_str, NULL, 10);
+}
+
+/*
+ * No error
+ */
+{
+ const gchar *endptr = NULL;
+ guint64 size = g_ascii_strtoull ("some-constant-string", (gchar **) &endptr, 10);
+}
+
+/*
+ * null passed to a callee which requires a non-null argument
+ * guint64 size = g_ascii_strtoull (NULL, NULL, 10);
+ * ~~~~ ^
+ */
+{
+ guint64 size = g_ascii_strtoull (NULL, NULL, 10);
+}