[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/realgud ad64b70 081/140: Correct testing for API change
From: |
Rocky Bernstein |
Subject: |
[elpa] externals/realgud ad64b70 081/140: Correct testing for API change... |
Date: |
Sat, 25 May 2019 19:35:38 -0400 (EDT) |
branch: externals/realgud
commit ad64b706e0755bc2bb6eaa694525367c73ebe4fc
Author: rocky <address@hidden>
Commit: rocky <address@hidden>
Correct testing for API change...
We now need more complete command buffers
---
realgud/common/buffer/command.el | 5 ++--
realgud/common/file.el | 7 +++---
realgud/debugger/jdb/core.el | 46 +++++++++++++++++-----------------
realgud/debugger/trepan2/core.el | 51 ++++++++++++++++++++++----------------
test/bt-helper.el | 5 ++--
test/test-bt-trepan.el | 53 +++++++++++++++++++++-------------------
test/test-file.el | 6 +----
test/test-trepan2.el | 29 ++++++++++++++--------
8 files changed, 112 insertions(+), 90 deletions(-)
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index eed0333..bfb870a 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -162,8 +162,9 @@
(realgud-struct-field-setter "realgud-cmdbuf-info" "ignore-re-file-list")
;; (realgud-struct-field-setter "realgud-cmdbuf-info" "filename-remap-alist")
-(defun realgud-cmdbuf-filename-remap-alist= (value)
- (setf (realgud-cmdbuf-info-filename-remap-alist realgud-cmdbuf-info)
value))
+(defun realgud-cmdbuf-filename-remap-alist= (value &optional buffer)
+ (setq buffer (realgud-get-cmdbuf buffer))
+ (setf (realgud-cmdbuf-info-filename-remap-alist realgud-cmdbuf-info) value))
(defun realgud:cmdbuf-follow-buffer(event)
(interactive "e")
diff --git a/realgud/common/file.el b/realgud/common/file.el
index 64a85ad..06ef03f 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -32,11 +32,12 @@
:type 'function
:group 'realgud)
-(defun realgud:find-file (marker filename directory)
+(defun realgud:find-file (marker filename directory &optional formats)
"A wrapper around compilation find-file. We set the prompt
to indicate we are looking for a source-code file."
- (let ((compilation-error "source-code file"))
- (compilation-find-file marker filename directory "%s")))
+ (or formats (setq formats "%s"))
+ (let ((compilation-error "source-code file"))
+ (compilation-find-file marker filename directory formats)))
(defun realgud:file-line-count(filename)
"Return the number of lines in file FILENAME, or nil FILENAME can't be
diff --git a/realgud/debugger/jdb/core.el b/realgud/debugger/jdb/core.el
index af0afb9..1deee1f 100644
--- a/realgud/debugger/jdb/core.el
+++ b/realgud/debugger/jdb/core.el
@@ -54,48 +54,50 @@ ca.mgcill.rocky.snpEff.main => ca/mcgill/rocky/snpEff"
(setq str (replace-regexp-in-string "\\." "/" str))
str)
-(defvar realgud:jdb-file-remap (make-hash-table :test 'equal)
- "How to remap Java files in jdb when we otherwise can't find in
- the filesystem. The hash key is the file string we saw, and the
- value is associated filesystem string presumably in the
- filesystem")
-
(defun realgud:jdb-find-file(marker filename directory)
"A find-file specific for java/jdb. We use `gdb-jdb-find-source' to map a
name to a filename. Failing that we can add on .java to the name. Failing that
-we will prompt for a mapping and save that in `realgud:jdb-file-remap' when
-that works."
+we will prompt for a mapping and save that the remap."
(let* ((transformed-file)
+ (cmdbuf (realgud-get-cmdbuf))
+ (ignore-re-file-list (realgud-cmdbuf-ignore-re-file-list cmdbuf))
+ (filename-remap-alist (realgud-cmdbuf-filename-remap-alist))
(stripped-filename (realgud:strip filename))
(gud-jdb-filename (gud-jdb-find-source stripped-filename))
+ (remapped-filename
+ (assoc filename filename-remap-alist))
)
(cond
((and gud-jdb-filename (file-exists-p gud-jdb-filename))
gud-jdb-filename)
((file-exists-p (setq transformed-file (concat stripped-filename
".java")))
transformed-file)
- ('t
- (if (gethash stripped-filename realgud:jdb-file-remap)
- (let ((remapped-filename))
- (setq remapped-filename (gethash stripped-filename
realgud:jdb-file-remap))
- (if (file-exists-p remapped-filename)
- remapped-filename
- ;; else
- (and (remhash filename realgud-file-remap) nil)))
+ ((realgud:file-ignore filename ignore-re-file-list)
+ (message "tracking ignored for %s" filename) nil)
+ (t
+ (if remapped-filename
+ (if (file-exists-p (cdr remapped-filename))
+ (cdr remapped-filename)
+ ;; else remove from map since no find
+ (and (realgud-cmdbuf-filename-remap-alist=
+ (delq (assoc remapped-filename filename-remap-alist)
+ filename-remap-alist))
+ nil))
;; else
(let ((remapped-filename)
(guess-filename (realgud:jdb-dot-to-slash filename)))
(setq remapped-filename
(buffer-file-name
- (compilation-find-file marker guess-filename
- directory "%s.java")))
+ (realgud:find-file marker guess-filename
+ directory "%s.java")))
(when (and remapped-filename (file-exists-p remapped-filename))
- (puthash stripped-filename remapped-filename realgud:jdb-file-remap)
- remapped-filename
+ (realgud-cmdbuf-filename-remap-alist=
+ (cons
+ (cons filename remapped-filename)
+ filename-remap-alist))
))
))
- ))
- )
+ )))
(defun realgud:jdb-loc-fn-callback(text filename lineno source-str
cmd-mark directory)
diff --git a/realgud/debugger/trepan2/core.el b/realgud/debugger/trepan2/core.el
index e2307ed..7bab489 100644
--- a/realgud/debugger/trepan2/core.el
+++ b/realgud/debugger/trepan2/core.el
@@ -54,33 +54,42 @@ blanks. Failing that we will prompt for a mapping and save
that
in variable `realgud:trepan2-file-remap' when that works. In the future,
we may also consult PYTHONPATH."
(let* ((transformed-file)
+ (cmdbuf (realgud-get-cmdbuf))
(stripped-filename (realgud:strip filename))
+ (ignore-re-file-list (realgud-cmdbuf-ignore-re-file-list cmdbuf))
+ (filename-remap-alist (realgud-cmdbuf-filename-remap-alist))
+ (remapped-filename
+ (assoc filename filename-remap-alist))
)
(cond
((file-exists-p filename) filename)
((file-exists-p stripped-filename) stripped-filename)
- ('t
+ ((realgud:file-ignore filename ignore-re-file-list)
+ (message "tracking ignored for %s" filename) nil)
+ (t
;; FIXME search PYTHONPATH if not absolute file
- (if (gethash filename realgud-file-remap)
- (let ((remapped-filename))
- (setq remapped-filename (gethash filename
realgud:trepan2-file-remap))
- (if (file-exists-p remapped-filename)
- remapped-filename
- ;; else
- (and (remhash filename realgud-file-remap)) nil)
- ;; else
- (let ((remapped-filename))
- (setq remapped-filename
- (buffer-file-name
- (compilation-find-file marker stripped-filename
- directory "%s.py")))
- (when (and remapped-filename (file-exists-p remapped-filename))
- (puthash filename remapped-filename realgud-file-remap)
- remapped-filename
- ))
- ))
- ))
- ))
+ (if remapped-filename
+ (if (file-exists-p (cdr remapped-filename))
+ (cdr remapped-filename)
+ ;; else remove from map since no find
+ (and (realgud-cmdbuf-filename-remap-alist=
+ (delq (assoc remapped-filename filename-remap-alist)
+ filename-remap-alist))
+ nil))
+ ;; else
+ (let ((remapped-filename))
+ (setq remapped-filename
+ (buffer-file-name
+ (realgud:find-file marker stripped-filename
+ directory "%s.py")))
+ (when (and remapped-filename (file-exists-p remapped-filename))
+ (realgud-cmdbuf-filename-remap-alist=
+ (cons
+ (cons filename remapped-filename)
+ filename-remap-alist))
+ ))
+ ))
+ )))
(defun realgud:trepan2-loc-fn-callback(text filename lineno source-str
cmd-mark directory)
diff --git a/test/bt-helper.el b/test/bt-helper.el
index a9f63d8..7155ea2 100644
--- a/test/bt-helper.el
+++ b/test/bt-helper.el
@@ -25,7 +25,8 @@ for DEBUGGER-NAME"
(gethash debugger-name realgud-pat-hash))
(switch-to-buffer nil)
- ))
+ )
+ temp-cmdbuf)
(defun setup-bt(debugger-name string)
@@ -37,7 +38,7 @@ for DEBUGGER-NAME and initializes it to STRING"
(goto-char (point-min))
(setq buffer-read-only nil)
(insert string)
- (font-lock-fontify-buffer)
+ (font-lock-ensure)
;; Newer emacs's use:
(goto-char (point-min))
)
diff --git a/test/test-bt-trepan.el b/test/test-bt-trepan.el
index 0bc5e6e..d065543 100644
--- a/test/test-bt-trepan.el
+++ b/test/test-bt-trepan.el
@@ -15,35 +15,38 @@
(defvar temp-bt)
)
-(setq temp-bt
- (setup-bt "trepan"
+(defun test-bt-trepan()
+ (setq temp-bt
+ (setup-bt "trepan"
"--> #0 METHOD Object#gcd(a, b) in file /test/gcd.rb at line 4
#1 TOP Object#<top /gcd.rb> in file /test/gcd.rb
at line 19
"))
-(with-current-buffer temp-bt
- (switch-to-buffer temp-bt)
- (goto-char (point-min))
- (dolist (pair
- '(
- ("#" . realgud-backtrace-number )
- ("METHO" . font-lock-keyword-face )
- ("Objec" . font-lock-constant-face )
- ("#" . font-lock-function-name-face )
- ("(" . font-lock-variable-name-face )
- ("/test" . realgud-file-name)
- ("line " . realgud-line-number)
- ("#" . realgud-backtrace-number)
- ("Objec" . font-lock-constant-face )
- ("<top" . font-lock-variable-name-face)
- ("/test" . realgud-file-name)
- ("line " . realgud-line-number)
- ))
- (search-forward (car pair))
- (assert-equal (cdr pair)
- (get-text-property (point) 'face))
- )
- )
+ (with-current-buffer temp-bt
+ (switch-to-buffer temp-bt)
+ (goto-char (point-min))
+ (dolist (pair
+ '(
+ ("#" . realgud-backtrace-number )
+ ("METHO" . font-lock-keyword-face )
+ ("Objec" . font-lock-constant-face )
+ ("#" . font-lock-function-name-face )
+ ("(" . font-lock-variable-name-face )
+ ("/test" . realgud-file-name)
+ ("line " . realgud-line-number)
+ ("#" . realgud-backtrace-number)
+ ("Objec" . font-lock-constant-face )
+ ("<top" . font-lock-variable-name-face)
+ ("/test" . realgud-file-name)
+ ("line " . realgud-line-number)
+ ))
+ (search-forward (car pair))
+ (assert-equal (cdr pair)
+ (get-text-property (point) 'face))
+ )
+ ))
+
+(test-bt-trepan)
(end-tests)
diff --git a/test/test-file.el b/test/test-file.el
index 71862af..15cc855 100644
--- a/test/test-file.el
+++ b/test/test-file.el
@@ -4,6 +4,7 @@
(require 'test-simple)
(load-file "../realgud/common/loc.el")
(load-file "../realgud/common/file.el")
+(load-file "../realgud/common/buffer/helper.el")
;; Note the below line number is tested so it must match what's listed
;; below.
@@ -21,15 +22,12 @@
(test-simple-start)
(eval-when-compile
- (defvar realgud-file-remap)
(defvar test-filename)
(defvar test-file-loc)
(defvar remap-filename)
(defvar old-compilation-find-file)
)
-(clrhash realgud-file-remap)
-
(setq old-compilation-find-file (symbol-function 'compilation-find-file))
(setq test-filename (symbol-file 'test-simple))
@@ -95,8 +93,6 @@
)
-(puthash remap-filename test-filename realgud-file-remap)
-
;; Need to set up a command buffer
;; (assert-t (realgud-loc?
;; (realgud:file-loc-from-line remap-filename 30))
diff --git a/test/test-trepan2.el b/test/test-trepan2.el
index e05874b..c5e7e4e 100644
--- a/test/test-trepan2.el
+++ b/test/test-trepan2.el
@@ -5,10 +5,12 @@
(load-file "../realgud/debugger/trepan2/trepan2.el")
(load-file "../realgud/debugger/trepan2/core.el")
(load-file "../realgud.el")
+(load-file "./bt-helper.el")
(declare-function trepan2-parse-cmd-args 'realgud:trepan2)
(declare-function realgud:trepan2-find-file 'realgud:trepan2-core)
(declare-function __FILE__ 'load-relative)
+(declare-function setup-bt-vars 'bt-helper)
(test-simple-start)
@@ -30,18 +32,25 @@
(trepan2-parse-cmd-args
'("trepan2" "program.py" "foo")))
+(eval-when-compile
+ (defvar test-python-file)
+ )
+
(note "realgud:trepan2-find-file")
-(assert-nil
- (realgud:trepan2-find-file nil "<string>" nil)
- "Should ignore pseudo file")
-(eval-when-compile
- (defvar test-python-file))
+(defun test-trepan2-find-file()
+ (let ((temp-cmdbuf (setup-bt-vars "trepan2")))
+ (with-current-buffer temp-cmdbuf
+ (assert-nil
+ (realgud:trepan2-find-file (mark) "<string>" nil)
+ "Should ignore pseudo file")
+
+ (set (make-local-variable 'test-python-file)
+ (concat (file-name-directory (__FILE__)) "gcd.py"))
+ (assert-equal test-python-file
+ (realgud:trepan2-find-file (mark) test-python-file nil)
+ "Should find file"))))
-(set (make-local-variable 'test-python-file)
- (concat (file-name-directory (__FILE__)) "gcd.py"))
-(assert-equal test-python-file
- (realgud:trepan2-find-file nil test-python-file nil)
- "Should find file")
+(test-trepan2-find-file)
(end-tests)
- [elpa] externals/realgud 937bea0 059/140: Add realgud-populate-common-fn-keys-none to not set function keys..., (continued)
- [elpa] externals/realgud 937bea0 059/140: Add realgud-populate-common-fn-keys-none to not set function keys..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 8258521 071/140: Small typo, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 2bf62ee 086/140: Better Emacs compatibility, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 0c3592b 078/140: Merge branch 'master' into filter-lists, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 4c66076 072/140: Start nodejs -> node debug rename..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud b4ff2c3 092/140: Check major mode with derived-mode-p, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud b78f3b9 091/140: Merge pull request #214 from xuchunyang/master, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud d25fd0e 090/140: Remove pdb alias, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 0a3befb 079/140: File remap is session specific..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud da2a74b 101/140: Merge branch 'master' of github.com:realgud/realgud, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud ad64b70 081/140: Correct testing for API change...,
Rocky Bernstein <=
- [elpa] externals/realgud dc349f8 075/140: Make calls consistent in light of changes, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f966711 093/140: Merge pull request #217 from muffinmad/patch-1, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 251eb8c 070/140: Small changes, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 09431a4 076/140: Commit stable version before a minor upheaval, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 6d521e9 080/140: Customize compilation-find-file..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud d24996a 082/140: Administrivia Add seq to el-get..., Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 388a650 077/140: Sync with savanah ELPA, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud f851166 089/140: Bug in kshdb initialization, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud 0ea8a13 094/140: Track breakpoing deletion, Rocky Bernstein, 2019/05/25
- [elpa] externals/realgud bb967ed 096/140: Add tbreak as per break, Rocky Bernstein, 2019/05/25