Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 39 lines (34 sloc) 1.5 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
;;;; -*- Mode: lisp; indent-tabs-mode: nil -*-
;;;;
;;;; This file is part of Sheeple.

;;;; tests/bootstrap.lisp
;;;;
;;;; Unit tests for src/bootstrap.lisp
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :sheeple)

(test shared-init-object)

(test init-object
  (let ((parent (object :properties '((prop1 NIL)))))
    (defreply init-object :before ((object parent) &key)
      (is (property-owner object 'prop1))
      (is (eq NIL (property-value object 'prop1)))
      (is (not (property-owner object 'prop2))))
    (defreply init-object :after ((object parent) &key)
      (is (property-owner object 'prop1))
      (is (eq 'val1 (property-value object 'prop1)))
      (is (property-owner object 'prop2))
      (is (eq 'val2 (property-value object 'prop2))))
    (defreply init-object :around ((object parent) &key)
      (is (eq NIL (property-value object 'prop1)))
      (prog1 (call-next-reply)
        (is (eq 'val1 (property-value object 'prop1)))
        (is (eq 'val2 (property-value object 'prop2)))))
    (let ((test-object (object :parents (list parent) :properties '((prop1 val1) (prop2 val2)))))
      (is (eq 'val1 (property-value test-object 'prop1)))
      (is (eq 'val2 (property-value test-object 'prop2))))))

(test reinit-object
  ;; TODO
  (let ((test-object (object)))
    (is (string= "value" (setf (property-value test-object 'var :accessor t) "value")))
    (is (direct-property-p test-object 'var))))
Something went wrong with that request. Please try again.