From a126c3684f8854f8c0d7ab5dcf55f31bac77dcf9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
Date: Mon, 30 Nov 2020 22:42:08 +0100
Subject: Test byte-compiler free variable warning

* test/lisp/emacs-lisp/bytecomp-tests.el (ert-x): Require.
(bytecomp--define-warning-file-test): New macro.
(bytecomp-warn/warn-free-setq\.el)
(bytecomp-warn/warn-free-variable-reference\.el): New tests.
* test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el:
* test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el:
New files.
---
 test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el             | 2 ++
 .../emacs-lisp/bytecomp-resources/warn-free-variable-reference.el     | 4 ++++
 2 files changed, 6 insertions(+)
 create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el
 create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el

(limited to 'test/lisp/emacs-lisp/bytecomp-resources')

diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el
new file mode 100644
index 00000000000..6e187129c9b
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-free-setq.el
@@ -0,0 +1,2 @@
+;;; -*- lexical-binding: t -*-
+(setq foo 'bar)
diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el
new file mode 100644
index 00000000000..50a95272874
--- /dev/null
+++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-free-variable-reference.el
@@ -0,0 +1,4 @@
+;;; -*- lexical-binding: t -*-
+(defvar xxx-test)
+(defun foo ()
+  (setq xxx-test bar))
-- 
cgit v1.2.3