kunit: add parent method reference to expectation

This allows for the InSequence prereq checker to generate proper error
messages with the right method name in it. The prerequisite list only
stores references to expectations so expectations should have an
internal reference to the method it is placed on.

Change-Id: Id4c732ce2d4f2ca550c9e9a7dbb924b9f1d8d544
Signed-off-by: Felix Guo <felixguo@google.com>
diff --git a/include/test/mock.h b/include/test/mock.h
index de604a7..a55338c 100644
--- a/include/test/mock.h
+++ b/include/test/mock.h
@@ -75,6 +75,7 @@
 	const char *expectation_name;
 	struct list_head node;
 	struct mock_matcher *matcher;
+	struct mock_method *method;
 	int times_called;
 };
 
diff --git a/test/mock.c b/test/mock.c
index 79da419..8928de8 100644
--- a/test/mock.c
+++ b/test/mock.c
@@ -57,7 +57,7 @@
 					    "Expectation was not called the specified number of times:\n\t");
 				stream->add(stream,
 					    "Function: %s, min calls: %d, max calls: %d, actual calls: %d",
-					    method->method_name,
+					    expectation->method->method_name,
 					    expectation->min_calls_expected,
 					    expectation->max_calls_expected,
 					    times_called);
@@ -172,7 +172,7 @@
 	}
 
 	list_add_tail(&expectation->node, &method->expectations);
-
+	expectation->method = method;
 	return 0;
 }