From da33bd8955b20f33c09ab34863a15ad190c23a72 Mon Sep 17 00:00:00 2001 From: jlamothe Date: Tue, 21 Nov 2023 19:49:19 +0000 Subject: [PATCH] test test_context() with a prior context --- test/test-context.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/test-context.c b/test/test-context.c index 09babae..8d49d34 100644 --- a/test/test-context.c +++ b/test/test-context.c @@ -47,6 +47,7 @@ struct ContextData // Internal Prototypes static void no_prior_context(TestState *); +static void prior_context(TestState *); static void test_context_common(TestState *, ContextData *); static void init_ContextData(ContextData *); static void get_context(TestState *); @@ -59,6 +60,7 @@ void test_test_context(TestState *s) { test_context(s, "no prior context", no_prior_context); + test_context(s, "prior context", prior_context); } // Internal Functions @@ -81,6 +83,24 @@ no_prior_context(TestState *s) test_context_common(s, &cd); } +static void +prior_context(TestState *s) +{ + ContextData cd; + + // set initial state + cd.new_context = "my other test"; + cd.initial_context = "bar"; + cd.initial_full_context = "foo: bar"; + cd.initial_depth = 2; + + // set expectations + cd.expected_sub_full_context = "foo: bar: my other test"; + cd.expected_sub_depth = 3; + + test_context_common(s, &cd); +} + static void test_context_common( TestState *s,