From dc449b071f9e87dde7ea5a227094f75cccdce8fd Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Mon, 11 May 2015 11:43:45 -0400 Subject: [PATCH] Move COMPILE-FILE-POSITION tests to their own file. --- tests/compiler-2.impure-cload.lisp | 51 ------------------------------- tests/compiler-3.impure-cload.lisp | 61 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 51 deletions(-) create mode 100644 tests/compiler-3.impure-cload.lisp diff --git a/tests/compiler-2.impure-cload.lisp b/tests/compiler-2.impure-cload.lisp index 98bb449f6..441852228 100644 --- a/tests/compiler-2.impure-cload.lisp +++ b/tests/compiler-2.impure-cload.lisp @@ -88,54 +88,3 @@ (multiple-value-bind (val foundp) (sb-int:info :variable :macro-expansion '%trash%) (assert (and (not val) (not foundp))))) - -;;; COMPILE-FILE-LINE and COMPILE-FILE-POSITION - -(macrolet ((line () `(multiple-value-call 'cons (compile-file-line)))) - (defun more-foo (x) - (if x - (format nil "Great! ~D" (line)) ; <-- this is line 97 - (format nil "Yikes ~D" (line))))) - -(declaim (inline thing)) -(defun thing () - (format nil "failed to frob a knob at line #~D" - (compile-file-line))) ; <-- this is line 103 - -(defmacro more-randomness () - '(progn - (let () - (thing)))) - -(macrolet () - (progn - (defun bork (x) - (flet () - (if x - (locally (declare (notinline thing)) - (more-randomness)) - (progn (more-randomness))))))) ; <-- this is line 117 - -(defun compile-file-pos-sharp-dot (x) - (list #.(format nil "Foo line ~D" (compile-file-line)) ; line #120 - x)) - -(defun compile-file-pos-eval-in-macro () - (macrolet ((macro (x) - (format nil "hi ~A at ~D" x - (compile-file-line)))) ; line #126 - (macro "there"))) - -(with-test (:name :compile-file-line) - (assert (string= (more-foo t) "Great! (97 . 32)")) - (assert (string= (more-foo nil) "Yikes (98 . 31)")) - (assert (string= (bork t) "failed to frob a knob at line #103")) - (assert (string= (bork nil) "failed to frob a knob at line #117")) - (assert (string= (car (compile-file-pos-sharp-dot nil)) - "Foo line 120")) - (assert (string= (compile-file-pos-eval-in-macro) - "hi there at 126"))) - -(eval-when (:compile-toplevel) - (let ((stream (sb-c::source-info-stream sb-c::*source-info*))) - (assert (pathname stream)))) diff --git a/tests/compiler-3.impure-cload.lisp b/tests/compiler-3.impure-cload.lisp new file mode 100644 index 000000000..b6748726f --- /dev/null +++ b/tests/compiler-3.impure-cload.lisp @@ -0,0 +1,61 @@ +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; While most of SBCL is derived from the CMU CL system, the test +;;;; files (like this one) were written from scratch after the fork +;;;; from CMU CL. +;;;; +;;;; This software is in the public domain and is provided with +;;;; absolutely no warranty. See the COPYING and CREDITS files for +;;;; more information. + +;;; COMPILE-FILE-LINE and COMPILE-FILE-POSITION + +(macrolet ((line () `(multiple-value-call 'cons (compile-file-line)))) + (defun more-foo (x) + (if x + (format nil "Great! ~D" (line)) ; <-- this is line 17 + (format nil "Yikes ~D" (line))))) + +(declaim (inline thing)) +(defun thing () + (format nil "failed to frob a knob at line #~D" + (compile-file-line))) ; <-- this is line 23 + +(defmacro more-randomness () + '(progn + (let () + (thing)))) + +(macrolet () + (progn + (defun bork (x) + (flet () + (if x + (locally (declare (notinline thing)) + (more-randomness)) + (progn (more-randomness))))))) ; <-- this is line 37 + +(defun compile-file-pos-sharp-dot (x) + (list #.(format nil "Foo line ~D" (compile-file-line)) ; line #40 + x)) + +(defun compile-file-pos-eval-in-macro () + (macrolet ((macro (x) + (format nil "hi ~A at ~D" x + (compile-file-line)))) ; line #46 + (macro "there"))) + +(with-test (:name :compile-file-line) + (assert (string= (more-foo t) "Great! (17 . 32)")) + (assert (string= (more-foo nil) "Yikes (18 . 31)")) + (assert (string= (bork t) "failed to frob a knob at line #23")) + (assert (string= (bork nil) "failed to frob a knob at line #37")) + (assert (string= (car (compile-file-pos-sharp-dot nil)) + "Foo line 40")) + (assert (string= (compile-file-pos-eval-in-macro) + "hi there at 46"))) + +(eval-when (:compile-toplevel) + (let ((stream (sb-c::source-info-stream sb-c::*source-info*))) + (assert (pathname stream)))) -- 2.11.4.GIT