diff --git a/coalton.asd b/coalton.asd index 7bee66b37..625e80bdb 100644 --- a/coalton.asd +++ b/coalton.asd @@ -231,7 +231,6 @@ (:module "parser" :serial t :components ((:file "cursor-tests"))) - (:file "parser-tests") (:file "entry-tests") (:file "toplevel-tests") (:file "type-inference-tests") @@ -243,6 +242,7 @@ :components ((:file "map-tests") (:file "lisp-type-tests"))) (:file "environment-persist-tests") + (:file "coalton-tests") (:file "slice-tests") (:file "float-tests") (:file "dual-tests") diff --git a/src/source.lisp b/src/source.lisp index 1b7481d42..80ae0e846 100644 --- a/src/source.lisp +++ b/src/source.lisp @@ -316,19 +316,6 @@ REPLACE is a 1-argument function that accepts and returns a string to suggest an :replacement (replace-function note) :message (message note))) -(defun source-error (&key (type :error) location (highlight :all) - message primary-note notes help-notes) - "Convenience function to unpack a LOCATION into source and span and create a source-error structure." - (declare (type location location)) - (source-error:source-error :type type - :span (location-span location) - :source (location-source location) - :highlight highlight - :message message - :primary-note primary-note - :notes notes - :help-notes help-notes)) - (defun make-source-error (type message notes) "Build a SOURCE-ERROR:SOURCE-ERROR structure by destructuring the first note in NOTES, and translating remaining notes to SOURCE-ERROR versions." (destructuring-bind (primary &rest secondary) notes diff --git a/tests/parser-tests.lisp b/tests/coalton-tests.lisp similarity index 92% rename from tests/parser-tests.lisp rename to tests/coalton-tests.lisp index ffd572f5d..eb6bb3f8a 100644 --- a/tests/parser-tests.lisp +++ b/tests/coalton-tests.lisp @@ -1,14 +1,14 @@ ;;;; Run test suites that parse and compile programs to exercise ;;;; specific areas of functionality. ;;;; -;;;; See tests/parser-test-files/README.md for input format and options. +;;;; See tests/test-files/README.md for input format and options. ;;;; See tests/loader.lisp and tests/utilities.lisp for load and ;;;; execution functions. (in-package #:coalton-tests) (defun %run-tests (name) - (run-test-file (format nil "tests/parser-test-files/~a" name))) + (run-test-file (format nil "tests/test-files/~a" name))) (deftest test-coalton-lang () (%run-tests "define-class.txt") diff --git a/tests/loader.lisp b/tests/loader.lisp index 106ee299d..09f82084d 100644 --- a/tests/loader.lisp +++ b/tests/loader.lisp @@ -1,9 +1,9 @@ ;;;; This package contains the function LOAD-TEST-FILE for loading ;;;; parser tests from specially formatted files. ;;;; -;;;; - The format is documented in tests/parser-test-files/README.md -;;;; - Tests are defined in tests/parser-test-files/*.txt -;;;; - These tests are loaded and run by tests/parser-tests.lisp +;;;; - The format is documented in tests/test-files/README.md +;;;; - Tests are defined in tests/test-files/*.txt +;;;; - These tests are loaded and run by tests/coalton-tests.lisp ;;;; - COALTON-TESTS:RUN-TEST-FILE and COALTON-TESTS:RUN-TEST are ;;;; defined in tests/utilities.lisp ;;;; diff --git a/tests/source-tests.lisp b/tests/source-tests.lisp index 02451a85f..ed869aadd 100644 --- a/tests/source-tests.lisp +++ b/tests/source-tests.lisp @@ -1,10 +1,10 @@ (in-package #:coalton-tests) -;; Check that wrapping a character input stream with -;; char-position-stream class allows callers to collect character -;; offset using 'file-position'. This is for gathering source offsets -;; that remain copmpatible with the offsets reported for source parsed -;; from internal strings. +;;; Check that wrapping a character input stream with +;;; char-position-stream class allows callers to collect character +;;; offset using 'file-position'. This is for gathering source offsets +;;; that remain compatible with the offsets reported for source parsed +;;; from internal strings. (deftest test-char-position-stream () (flet ((stream-contents (stream) @@ -12,7 +12,7 @@ := (read-char stream nil nil) :while char :collect (cons char (file-position stream))))) - (with-open-file (stream (test-file "tests/parser-test-files/unicode.coal") + (with-open-file (stream (test-file "tests/test-files/unicode.coal") :direction ':input :element-type 'character :external-format :utf-8) @@ -22,7 +22,7 @@ (format nil "File expected length 86 != ~A" (length chars))) (is (equal 72 ; byte offset would have been 76 (cdr (nth 71 chars))) - "Scond kanji is at char offset, not byte offset"))))) + "Second kanji is at char offset, not byte offset"))))) (deftest test-location () (let* ((source (source:make-source-string "1234567890")) diff --git a/tests/parser-test-files/README.md b/tests/test-files/README.md similarity index 100% rename from tests/parser-test-files/README.md rename to tests/test-files/README.md diff --git a/tests/parser-test-files/define-class.txt b/tests/test-files/define-class.txt similarity index 100% rename from tests/parser-test-files/define-class.txt rename to tests/test-files/define-class.txt diff --git a/tests/parser-test-files/define-instance.txt b/tests/test-files/define-instance.txt similarity index 100% rename from tests/parser-test-files/define-instance.txt rename to tests/test-files/define-instance.txt diff --git a/tests/parser-test-files/define-type.txt b/tests/test-files/define-type.txt similarity index 100% rename from tests/parser-test-files/define-type.txt rename to tests/test-files/define-type.txt diff --git a/tests/parser-test-files/define.txt b/tests/test-files/define.txt similarity index 100% rename from tests/parser-test-files/define.txt rename to tests/test-files/define.txt diff --git a/tests/parser-test-files/fundeps.txt b/tests/test-files/fundeps.txt similarity index 100% rename from tests/parser-test-files/fundeps.txt rename to tests/test-files/fundeps.txt diff --git a/tests/parser-test-files/hashtable.txt b/tests/test-files/hashtable.txt similarity index 100% rename from tests/parser-test-files/hashtable.txt rename to tests/test-files/hashtable.txt diff --git a/tests/parser-test-files/lisp-toplevel-forbid.txt b/tests/test-files/lisp-toplevel-forbid.txt similarity index 100% rename from tests/parser-test-files/lisp-toplevel-forbid.txt rename to tests/test-files/lisp-toplevel-forbid.txt diff --git a/tests/parser-test-files/lisp-toplevel.txt b/tests/test-files/lisp-toplevel.txt similarity index 100% rename from tests/parser-test-files/lisp-toplevel.txt rename to tests/test-files/lisp-toplevel.txt diff --git a/tests/parser-test-files/package.txt b/tests/test-files/package.txt similarity index 100% rename from tests/parser-test-files/package.txt rename to tests/test-files/package.txt diff --git a/tests/parser-test-files/parse-and.txt b/tests/test-files/parse-and.txt similarity index 100% rename from tests/parser-test-files/parse-and.txt rename to tests/test-files/parse-and.txt diff --git a/tests/parser-test-files/parse-attribute.txt b/tests/test-files/parse-attribute.txt similarity index 100% rename from tests/parser-test-files/parse-attribute.txt rename to tests/test-files/parse-attribute.txt diff --git a/tests/parser-test-files/parse-body.txt b/tests/test-files/parse-body.txt similarity index 100% rename from tests/parser-test-files/parse-body.txt rename to tests/test-files/parse-body.txt diff --git a/tests/parser-test-files/parse-break.txt b/tests/test-files/parse-break.txt similarity index 100% rename from tests/parser-test-files/parse-break.txt rename to tests/test-files/parse-break.txt diff --git a/tests/parser-test-files/parse-cond.txt b/tests/test-files/parse-cond.txt similarity index 100% rename from tests/parser-test-files/parse-cond.txt rename to tests/test-files/parse-cond.txt diff --git a/tests/parser-test-files/parse-continue.txt b/tests/test-files/parse-continue.txt similarity index 100% rename from tests/parser-test-files/parse-continue.txt rename to tests/test-files/parse-continue.txt diff --git a/tests/parser-test-files/parse-declare.txt b/tests/test-files/parse-declare.txt similarity index 100% rename from tests/parser-test-files/parse-declare.txt rename to tests/test-files/parse-declare.txt diff --git a/tests/parser-test-files/parse-do.txt b/tests/test-files/parse-do.txt similarity index 100% rename from tests/parser-test-files/parse-do.txt rename to tests/test-files/parse-do.txt diff --git a/tests/parser-test-files/parse-expression.txt b/tests/test-files/parse-expression.txt similarity index 100% rename from tests/parser-test-files/parse-expression.txt rename to tests/test-files/parse-expression.txt diff --git a/tests/parser-test-files/parse-fn.txt b/tests/test-files/parse-fn.txt similarity index 100% rename from tests/parser-test-files/parse-fn.txt rename to tests/test-files/parse-fn.txt diff --git a/tests/parser-test-files/parse-for.txt b/tests/test-files/parse-for.txt similarity index 100% rename from tests/parser-test-files/parse-for.txt rename to tests/test-files/parse-for.txt diff --git a/tests/parser-test-files/parse-if.txt b/tests/test-files/parse-if.txt similarity index 100% rename from tests/parser-test-files/parse-if.txt rename to tests/test-files/parse-if.txt diff --git a/tests/parser-test-files/parse-let.txt b/tests/test-files/parse-let.txt similarity index 100% rename from tests/parser-test-files/parse-let.txt rename to tests/test-files/parse-let.txt diff --git a/tests/parser-test-files/parse-lisp.txt b/tests/test-files/parse-lisp.txt similarity index 100% rename from tests/parser-test-files/parse-lisp.txt rename to tests/test-files/parse-lisp.txt diff --git a/tests/parser-test-files/parse-loop.txt b/tests/test-files/parse-loop.txt similarity index 100% rename from tests/parser-test-files/parse-loop.txt rename to tests/test-files/parse-loop.txt diff --git a/tests/parser-test-files/parse-match.txt b/tests/test-files/parse-match.txt similarity index 100% rename from tests/parser-test-files/parse-match.txt rename to tests/test-files/parse-match.txt diff --git a/tests/parser-test-files/parse-method.txt b/tests/test-files/parse-method.txt similarity index 100% rename from tests/parser-test-files/parse-method.txt rename to tests/test-files/parse-method.txt diff --git a/tests/parser-test-files/parse-or.txt b/tests/test-files/parse-or.txt similarity index 100% rename from tests/parser-test-files/parse-or.txt rename to tests/test-files/parse-or.txt diff --git a/tests/parser-test-files/parse-pattern.txt b/tests/test-files/parse-pattern.txt similarity index 100% rename from tests/parser-test-files/parse-pattern.txt rename to tests/test-files/parse-pattern.txt diff --git a/tests/parser-test-files/parse-return.txt b/tests/test-files/parse-return.txt similarity index 100% rename from tests/parser-test-files/parse-return.txt rename to tests/test-files/parse-return.txt diff --git a/tests/parser-test-files/parse-the.txt b/tests/test-files/parse-the.txt similarity index 100% rename from tests/parser-test-files/parse-the.txt rename to tests/test-files/parse-the.txt diff --git a/tests/parser-test-files/parse-toplevel.txt b/tests/test-files/parse-toplevel.txt similarity index 100% rename from tests/parser-test-files/parse-toplevel.txt rename to tests/test-files/parse-toplevel.txt diff --git a/tests/parser-test-files/parse-type.txt b/tests/test-files/parse-type.txt similarity index 100% rename from tests/parser-test-files/parse-type.txt rename to tests/test-files/parse-type.txt diff --git a/tests/parser-test-files/parse-unless.txt b/tests/test-files/parse-unless.txt similarity index 100% rename from tests/parser-test-files/parse-unless.txt rename to tests/test-files/parse-unless.txt diff --git a/tests/parser-test-files/parse-when.txt b/tests/test-files/parse-when.txt similarity index 100% rename from tests/parser-test-files/parse-when.txt rename to tests/test-files/parse-when.txt diff --git a/tests/parser-test-files/parse-while-let.txt b/tests/test-files/parse-while-let.txt similarity index 100% rename from tests/parser-test-files/parse-while-let.txt rename to tests/test-files/parse-while-let.txt diff --git a/tests/parser-test-files/parse-while.txt b/tests/test-files/parse-while.txt similarity index 100% rename from tests/parser-test-files/parse-while.txt rename to tests/test-files/parse-while.txt diff --git a/tests/parser-test-files/recursive-let.txt b/tests/test-files/recursive-let.txt similarity index 100% rename from tests/parser-test-files/recursive-let.txt rename to tests/test-files/recursive-let.txt diff --git a/tests/parser-test-files/struct.txt b/tests/test-files/struct.txt similarity index 100% rename from tests/parser-test-files/struct.txt rename to tests/test-files/struct.txt diff --git a/tests/parser-test-files/toplevel-progn.txt b/tests/test-files/toplevel-progn.txt similarity index 100% rename from tests/parser-test-files/toplevel-progn.txt rename to tests/test-files/toplevel-progn.txt diff --git a/tests/parser-test-files/type-inference.txt b/tests/test-files/type-inference.txt similarity index 100% rename from tests/parser-test-files/type-inference.txt rename to tests/test-files/type-inference.txt diff --git a/tests/parser-test-files/unicode.coal b/tests/test-files/unicode.coal similarity index 100% rename from tests/parser-test-files/unicode.coal rename to tests/test-files/unicode.coal diff --git a/tests/parser-test-files/unicode.txt b/tests/test-files/unicode.txt similarity index 100% rename from tests/parser-test-files/unicode.txt rename to tests/test-files/unicode.txt diff --git a/tests/parser-test-files/unused-variables.txt b/tests/test-files/unused-variables.txt similarity index 100% rename from tests/parser-test-files/unused-variables.txt rename to tests/test-files/unused-variables.txt