anchor.diff:                 (mapcar (lambda (e) (event-value e :foo)) (next-upto-n pstr 8))))
         "pstream's number is not accessible with pk"))
   
  -(test next
  -  "Test next and next-upto-n"
  -  (is-true (equal (list (list 0 1) (list 2 3) (list 4) nil)
  -                  (let ((pstr (as-pstream (pseries 0 1 5))))
  -                    (list (next-upto-n pstr 2)
  -                          (next-upto-n pstr 2)
  -                          (next-upto-n pstr 2)
  -                          (next-upto-n pstr 2))))
  -           "next-upto-n gives wrong results"))
  +(test last-output
  +  "Test `last-output' function"
  +  (let ((pstr (as-pstream (pbind :x (pseq (list 1 2) 1)))))
  +    (is-false (cl-patterns::last-output pstr)
  +              "last-output doesn't return nil on pstreams not yet started")
  +    (next pstr)
  +    (is (event-equal (event :x 1)
  +                     (cl-patterns::last-output pstr))
  +        "last-output doesn't return the first output of a pstream")
  +    (next pstr)
  +    (is (event-equal (event :x 2)
  +                     (cl-patterns::last-output pstr))
  +        "last-output doesn't return the second output of a pstream")
  +    (next pstr)
  +    (is (event-equal (event :x 2)
  +                     (cl-patterns::last-output pstr))
  +        "last-output doesn't return the second output of a pstream")))
   
   (test peek
     "Test peek functionality"
  
positive.code:              (event :beat 3 :x 0)
               (event :beat 5 :x 1))
              (next-upto-n (pbind :beat 2
                                  :embed (pbind :beat (p+ (pk :beat) (pseq '(1 3) 1))
                                                :x (pseries)))))
             ":beat key is not accessible in embedded patterns")
    (is-true (equal (list 0 1/2 1 3/2 2 5/2 3 7/2)
  
negative.code:          (let ((pstr (as-pstream (pbind :dur 1/3 :foo (pseq (list 1 2 3) 1)))))
             (peek pstr)
             (beat pstr)))
        "beat method is counting peeked outputs")
    (is (equal (list 1 2 nil)
               (peek-n (pseq (list 1 2) 1) 3))
        "peek-n does not return correct results")
    (is (equal (list 1 2)
               (peek-upto-n (pseq (list 1 2) 1) 3))
        "peek-upto-n does not return correct results"))
  
  (test next
    "Test next and next-upto-n"
  