Skip to content

Commit

Permalink
tests/offline/start: Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
aadcg committed Feb 13, 2023
1 parent a2c6e17 commit 3bc1f9e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions nyxt.asd
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ The renderer is configured from NYXT_RENDERER or `*nyxt-renderer*'."))
:targets (:package :nyxt/tests)
:serial t
:components ((:file "tests/package")
(:file "tests/offline/start")
(:file "tests/offline/define-configuration")
(:file "tests/offline/global-history")
(:file "tests/offline/user-script-parsing")
Expand Down
35 changes: 35 additions & 0 deletions tests/offline/start.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;;;; SPDX-FileCopyrightText: Atlas Engineer LLC
;;;; SPDX-License-Identifier: BSD-3-Clause

(in-package :nyxt/tests)

(define-class dummy-renderer (renderer)
((name "Dummy renderer"))
(:export-class-name-p t)
(:export-accessor-names-p t)
(:accessor-name-transformer (class*:make-name-transformer name)))

(defmethod install ((_ dummy-renderer)) t)

(defmethod uninstall ((_ dummy-renderer)) t)

(setf nyxt::*renderer* (make-instance 'dummy-renderer))

(define-test null-quit ()
(assert-false (nyxt:quit)))

(define-test start-quit ()
(assert-false (progn (nyxt:start) (nyxt:quit))))

(define-test stateless-headless-argument ()
(nyxt:start :headless t :failsafe t)
(ffi-within-renderer-thread
nyxt:*browser*
(lambda () (assert-true nyxt::*headless-p*)))
(nyxt:quit)

(nyxt:start :failsafe t)
(ffi-within-renderer-thread
nyxt:*browser*
(lambda () (assert-false nyxt::*headless-p*)))
(nyxt:quit))

0 comments on commit 3bc1f9e

Please sign in to comment.