emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 13f64b0 2/2: Use lexical-binding in most semantic tests


From: Stefan Kangas
Subject: master 13f64b0 2/2: Use lexical-binding in most semantic tests
Date: Tue, 28 Apr 2020 10:12:20 -0400 (EDT)

branch: master
commit 13f64b052f5104e143ec1c14f47a0738c26f5766
Author: Stefan Kangas <address@hidden>
Commit: Stefan Kangas <address@hidden>

    Use lexical-binding in most semantic tests
    
    * test/lisp/cedet/semantic-utest-fmt.el:
    * test/lisp/cedet/semantic-utest-ia.el:
    * test/lisp/cedet/semantic-utest.el:
    * test/lisp/cedet/srecode-utest-getset.el:
    * test/lisp/cedet/srecode-utest-template.el: Use lexical-binding.
    
    * test/lisp/cedet/semantic-utest-fmt.el (semantic-fmt-utest):
    * test/lisp/cedet/semantic-utest.el (semantic-utest-generic)
    (semantic-utest-Python, semantic-utest-Javascript)
    (semantic-utest-Java, semantic-utest-Makefile)
    (semantic-utest-Scheme, semantic-utest-Html, semantic-utest-PHP)
    (semantic-utest-Csharp, semantic-utest-last-invalid):
    * test/lisp/cedet/semantic-utest-ia.el (semantic-ia-utest-buffer)
    (semantic-symref-test-count-hits-in-tag):
    * test/lisp/cedet/srecode-utest-getset.el
    (srecode-insert-getset-fully-automatic-flag): Silence
    byte-compiler.
---
 test/lisp/cedet/semantic-utest-fmt.el     |  4 +---
 test/lisp/cedet/semantic-utest-ia.el      |  7 +++----
 test/lisp/cedet/semantic-utest.el         | 30 ++++++++++++++----------------
 test/lisp/cedet/srecode-utest-getset.el   |  3 ++-
 test/lisp/cedet/srecode-utest-template.el |  2 +-
 5 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/test/lisp/cedet/semantic-utest-fmt.el 
b/test/lisp/cedet/semantic-utest-fmt.el
index 2fc2b68..c2f2bb7 100644
--- a/test/lisp/cedet/semantic-utest-fmt.el
+++ b/test/lisp/cedet/semantic-utest-fmt.el
@@ -1,4 +1,4 @@
-;;; cedet/semantic-utest-fmt.el --- Parsing / Formatting tests
+;;; cedet/semantic-utest-fmt.el --- Parsing / Formatting tests -*- 
lexical-binding:t -*-
 
 ;;; Copyright (C) 2003-2004, 2007-2020 Free Software Foundation, Inc.
 
@@ -69,7 +69,6 @@ Files to visit are in `semantic-fmt-utest-file-list'."
          ;; Run the tests.
          (let ((fb (find-buffer-visiting fname))
                (b (semantic-find-file-noselect fname))
-               (num 0)
                (tags nil))
 
            (save-current-buffer
@@ -82,7 +81,6 @@ Files to visit are in `semantic-fmt-utest-file-list'."
              (semantic-clear-toplevel-cache)
              ;; Force the reparse
              (setq tags (semantic-fetch-tags))
-             (setq num (length tags))
 
              (save-excursion
                (while tags
diff --git a/test/lisp/cedet/semantic-utest-ia.el 
b/test/lisp/cedet/semantic-utest-ia.el
index 5761224..c99ef97 100644
--- a/test/lisp/cedet/semantic-utest-ia.el
+++ b/test/lisp/cedet/semantic-utest-ia.el
@@ -1,4 +1,4 @@
-;;; semantic-utest-ia.el --- Analyzer unit tests
+;;; semantic-utest-ia.el --- Analyzer unit tests  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2008-2020 Free Software Foundation, Inc.
 
@@ -211,7 +211,7 @@
                ;; completions, then remove the below debug-on-error setting.
                (debug-on-error nil)
               (acomp
-               (condition-case err
+               (condition-case _err
                    (semantic-analyze-possible-completions ctxt)
                   ((error user-error) nil))
                 ))
@@ -438,11 +438,10 @@ tag that contains point, and return that."
   (let* ((ctxt (semantic-analyze-current-context))
         (target (car (reverse (oref ctxt prefix))))
         (tag (semantic-current-tag))
-        (start (current-time))
         (Lcount 0))
     (when (semantic-tag-p target)
       (semantic-symref-hits-in-region
-       target (lambda (start end prefix) (setq Lcount (1+ Lcount)))
+       target (lambda (_start _end _prefix) (setq Lcount (1+ Lcount)))
        (semantic-tag-start tag)
        (semantic-tag-end tag))
       Lcount)))
diff --git a/test/lisp/cedet/semantic-utest.el 
b/test/lisp/cedet/semantic-utest.el
index 1a7a865..e537871 100644
--- a/test/lisp/cedet/semantic-utest.el
+++ b/test/lisp/cedet/semantic-utest.el
@@ -1,4 +1,4 @@
-;;; semantic-utest.el --- Tests for semantic's parsing system.
+;;; semantic-utest.el --- Tests for semantic's parsing system. -*- 
lexical-binding:t -*-
 
 ;;; Copyright (C) 2003-2004, 2007-2020 Free Software Foundation, Inc.
 
@@ -537,10 +537,9 @@ Pre-fill the buffer with CONTENTS."
 
 
 
-(defun semantic-utest-generic (testname filename contents name-contents 
names-removed killme insertme)
+(defun semantic-utest-generic (filename contents name-contents names-removed 
killme insertme)
   "Generic unit test according to template.
 Should work for languages without .h files, python javascript java.
-TESTNAME is the name of the test.
 FILENAME is the name of the file to create.
 CONTENTS is the contents of the file to test.
 NAME-CONTENTS is the list of names that should be in the contents.
@@ -564,10 +563,8 @@ INSERTME is the text to be inserted after the deletion."
       (sit-for 0)
 
       ;; Run the tests.
-      ;;(message "First parsing test %s." testname)
       (should (semantic-utest-verify-names name-contents))
 
-      ;;(message "Invalid tag test %s." testname)
       (semantic-utest-last-invalid name-contents names-removed killme insertme)
       (should (semantic-utest-verify-names name-contents))
 
@@ -576,16 +573,17 @@ INSERTME is the text to be inserted after the deletion."
       (kill-buffer buff)
       )))
 
+(defvar python-indent-guess-indent-offset) ; Silence byte-compiler.
 (ert-deftest semantic-utest-Python()
   (skip-unless (fboundp 'python-mode))
   (let ((python-indent-guess-indent-offset nil))
-    (semantic-utest-generic "Python" (semantic-utest-fname "pytest.py") 
semantic-utest-Python-buffer-contents  semantic-utest-Python-name-contents   
'("fun2") "#1" "#deleted line")
+    (semantic-utest-generic (semantic-utest-fname "pytest.py") 
semantic-utest-Python-buffer-contents  semantic-utest-Python-name-contents   
'("fun2") "#1" "#deleted line")
     ))
 
 
 (ert-deftest semantic-utest-Javascript()
   (if (fboundp 'javascript-mode)
-      (semantic-utest-generic "Javascript" (semantic-utest-fname 
"javascripttest.js") semantic-utest-Javascript-buffer-contents  
semantic-utest-Javascript-name-contents   '("fun2") "//1" "//deleted line")
+      (semantic-utest-generic (semantic-utest-fname "javascripttest.js") 
semantic-utest-Javascript-buffer-contents  
semantic-utest-Javascript-name-contents   '("fun2") "//1" "//deleted line")
     (message "Skipping JavaScript test: NO major mode."))
   )
 
@@ -593,34 +591,34 @@ INSERTME is the text to be inserted after the deletion."
   ;; If JDE is installed, it might mess things up depending on the version
   ;; that was installed.
   (let ((auto-mode-alist  '(("\\.java\\'" . java-mode))))
-    (semantic-utest-generic "Java" (semantic-utest-fname "JavaTest.java") 
semantic-utest-Java-buffer-contents  semantic-utest-Java-name-contents   
'("fun2") "//1" "//deleted line")
+    (semantic-utest-generic (semantic-utest-fname "JavaTest.java") 
semantic-utest-Java-buffer-contents  semantic-utest-Java-name-contents   
'("fun2") "//1" "//deleted line")
     ))
 
 (ert-deftest semantic-utest-Makefile()
-  (semantic-utest-generic "Makefile" (semantic-utest-fname "Makefile") 
semantic-utest-Makefile-buffer-contents  semantic-utest-Makefile-name-contents  
 '("fun2") "#1" "#deleted line")
+  (semantic-utest-generic (semantic-utest-fname "Makefile") 
semantic-utest-Makefile-buffer-contents  semantic-utest-Makefile-name-contents  
 '("fun2") "#1" "#deleted line")
   )
 
 (ert-deftest semantic-utest-Scheme()
   (skip-unless nil) ;; There is a bug w/ scheme parser.  Skip this for now.
-  (semantic-utest-generic "Scheme" (semantic-utest-fname "tst.scm") 
semantic-utest-Scheme-buffer-contents  semantic-utest-Scheme-name-contents   
'("fun2") ";1" ";deleted line")
+  (semantic-utest-generic (semantic-utest-fname "tst.scm") 
semantic-utest-Scheme-buffer-contents  semantic-utest-Scheme-name-contents   
'("fun2") ";1" ";deleted line")
   )
 
-
+(defvar html-helper-build-new-buffer) ; Silence byte-compiler.
 (ert-deftest semantic-utest-Html()
   ;; Disable html-helper auto-fill-in mode.
-  (let ((html-helper-build-new-buffer nil))
-    (semantic-utest-generic "HTML" (semantic-utest-fname "tst.html") 
semantic-utest-Html-buffer-contents  semantic-utest-Html-name-contents   
'("fun2") "<!--1-->" "<!--deleted line-->")
+  (let ((html-helper-build-new-buffer nil)) ; FIXME: Why is this bound?
+    (semantic-utest-generic (semantic-utest-fname "tst.html") 
semantic-utest-Html-buffer-contents  semantic-utest-Html-name-contents   
'("fun2") "<!--1-->" "<!--deleted line-->")
     ))
 
 (ert-deftest semantic-utest-PHP()
   (skip-unless (featurep 'php-mode))
-  (semantic-utest-generic "PHP" (semantic-utest-fname "phptest.php") 
semantic-utest-PHP-buffer-contents semantic-utest-PHP-name-contents '("fun1") 
"fun2" "%^@")
+  (semantic-utest-generic (semantic-utest-fname "phptest.php") 
semantic-utest-PHP-buffer-contents semantic-utest-PHP-name-contents '("fun1") 
"fun2" "%^@")
   )
 
 ;look at http://mfgames.com/linux/csharp-mode
 (ert-deftest semantic-utest-Csharp() ;; hmm i don't even know how to edit a 
scharp file. need a csharp mode implementation i suppose
   (skip-unless (featurep 'csharp-mode))
-  (semantic-utest-generic "C#" (semantic-utest-fname "csharptest.cs") 
semantic-utest-Csharp-buffer-contents  semantic-utest-Csharp-name-contents   
'("fun2") "//1" "//deleted line")
+  (semantic-utest-generic (semantic-utest-fname "csharptest.cs") 
semantic-utest-Csharp-buffer-contents  semantic-utest-Csharp-name-contents   
'("fun2") "//1" "//deleted line")
   )
 
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -758,7 +756,7 @@ JAVE this thing would need to be recursive to handle java 
and csharp"
   (sit-for 0)
   )
 
-(defun semantic-utest-last-invalid (name-contents names-removed killme 
insertme)
+(defun semantic-utest-last-invalid (_name-contents _names-removed killme 
insertme)
   "Make the last fcn invalid."
   (semantic-utest-kill-indicator killme insertme)
 ;  (semantic-utest-verify-names name-contents names-removed); verify its gone 
;new validator doesn't handle skipnames yet
diff --git a/test/lisp/cedet/srecode-utest-getset.el 
b/test/lisp/cedet/srecode-utest-getset.el
index e49a195..3419b18 100644
--- a/test/lisp/cedet/srecode-utest-getset.el
+++ b/test/lisp/cedet/srecode-utest-getset.el
@@ -1,4 +1,4 @@
-;;; srecode/test-getset.el --- Test the getset inserter.
+;;; srecode/test-getset.el --- Test the getset inserter. -*- lexical-binding:t 
-*-
 
 ;; Copyright (C) 2008, 2009, 2011, 2019-2020 Free Software Foundation, Inc
 
@@ -52,6 +52,7 @@ private:
    temporary-file-directory)
   "File used to do testing.")
 
+(defvar srecode-insert-getset-fully-automatic-flag) ; Silence byte-compiler.
 (ert-deftest srecode-utest-getset-output ()
   "Test various template insertion options."
   (save-excursion
diff --git a/test/lisp/cedet/srecode-utest-template.el 
b/test/lisp/cedet/srecode-utest-template.el
index 4dd64e2..63c33a3 100644
--- a/test/lisp/cedet/srecode-utest-template.el
+++ b/test/lisp/cedet/srecode-utest-template.el
@@ -1,4 +1,4 @@
-;;; srecode/test.el --- SRecode Core Template tests.
+;;; srecode/test.el --- SRecode Core Template tests. -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2008-2020 Free Software Foundation, Inc.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]