{"size": 2019, "ext": "scrbl", "max_stars_repo_path": "mock/private/history.scrbl", "max_stars_repo_name": "countvajhula/racket-mock", "max_stars_repo_stars_event_min_datetime": "2015-08-21T21:58:29.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-28T19:27:13.000Z", "max_issues_repo_path": "mock/private/history.scrbl", "max_issues_repo_name": "countvajhula/racket-mock", "max_issues_repo_issues_event_min_datetime": "2015-08-21T22:02:33.000Z", "max_issues_repo_issues_event_max_datetime": "2021-12-14T21:18:59.000Z", "max_forks_repo_path": "mock/private/history.scrbl", "max_forks_repo_name": "countvajhula/racket-mock", "max_forks_repo_forks_event_min_datetime": "2015-08-21T23:18:03.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-11T01:47:51.000Z"}
{"max_stars_count": 22, "max_issues_count": 131, "max_forks_count": 10, "avg_line_length": 38.8269230769, "max_line_length": 80, "alphanum_fraction": 0.6483407628}
#lang scribble/manual
@(require "util-doc.rkt")

@title{Mock Call Histories}

@defproc[(call-history) call-history?]{
 Constructs a fresh mock call history value. Every @mock-tech{mock} has an
 associated call history, although external call histories can be shared between
 mocks. Call histories store a log of @racket[mock-call] values in the order the
 calls were made.}

@defproc[(call-history? [v any/c]) boolean?]{
 Returns true when @racket[v] is a @racket[call-history] value, and false
 otherwise.}

@defproc[(call-history-record! [history call-history?] [call mock-call?])
         void?]{
 Saves @racket[call] in @racket[history] as the most recent mock call.}

@defproc[(call-history-calls [history call-history?]) (listof mock-call?)]{
 Returns a list of all calls recorded in @racket[history] with
 @racket[call-history-record!]. The list contains calls in order of least recent
 to most recent.
 @(mock-examples
   (define history (call-history))
   (call-history-record! history
                         (mock-call #:name 'foo
                                    #:args (arguments 1 2 3)
                                    #:results (list 'foo)))
   (call-history-record! history
                         (mock-call #:name 'bar
                                    #:args (arguments 10 20 30)
                                    #:results (list 'bar)))
   (call-history-calls history))}

@defproc[(call-history-count [history call-history?]) (listof mock-call?)]{
 Returns the number of calls recorded in @racket[history].
 @(mock-examples
   (define history (call-history))
   (call-history-count history)
   (call-history-record! history (mock-call))
   (call-history-count history))}

@defproc[(call-history-reset! [history call-history?]) void?]{
 Erases all calls from @racket[history], in a similar manner to
 @racket[mock-reset!].
 @(mock-examples
   (define history (call-history))
   (call-history-record! history (mock-call))
   (call-history-reset! history)
   (call-history-calls history))}
