branch: externals/realgud-trepan-xpy commit 9888ed64728d3125c71c334e7cdce14584a3b243 Author: rocky <r...@dustyfeet.com> Commit: rocky <r...@dustyfeet.com>
Add NEWS and misc updates --- Makefile.am | 2 +- NEWS | 4 ++ README.md | 8 +-- configure.ac | 5 +- test/test-regexp-trepan-xpy.el | 108 +++++++++++++++++++++++++++++++++++++++++ test/test-trepan-xpy.el | 40 +++++++++++++++ trepan-xpy/trepan-xpy.el | 2 +- 7 files changed, 158 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index c1f6c8f945..177084ba83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ include common.mk PHONY=check clean dist distclean test check-short check-terse install-short -EXTRA_DIST = common.mk.in README.md THANKS $(lisp_files) +EXTRA_DIST = common.mk.in NEWS README.md THANKS $(lisp_files) if MAINTAINER_MODE diff --git a/NEWS b/NEWS new file mode 100644 index 0000000000..7a504b98ab --- /dev/null +++ b/NEWS @@ -0,0 +1,4 @@ +1.0.0 +===== + +Initial version diff --git a/README.md b/README.md index 37564e4033..6de99a9e44 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,5 @@ From github source (compile (format "EMACSLOADPATH=:%s:%s ./autogen.sh" (file-name-directory (locate-library "test-simple.elc")) (file-name-directory (locate-library "realgud.elc")))) ``` -[travis-image]: https://api.travis-ci.org/realgud/realgud-lldb.svg?branch=master -[travis-url]: https://travis-ci.org/realgud/realgud-lldb -[melpa-stable-image]: http://stable.melpa.org/packages/realgud-lldb-badge.svg -[melpa-stable]: http://stable.melpa.org/#/realgud-lldb -[melpa-image]: http://melpa.org/packages/realgud-lldb-badge.svg -[melpa]: http://melpa.org/#/realgud-lldb +[gnu-elpa-image]: https://elpa.gnu.org/packages/realgud-trepan-xpy.svg +[gnu-elpa]: https://elpa.gnu.org/packages/realgud-trepan-xpy.html diff --git a/configure.ac b/configure.ac index b9d28a60ac..d8437906d5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,12 +1,11 @@ dnl FIXME: pick up from realgud.el -AC_INIT(realgud-trepan-xpy, 1.0.0,) +AC_INIT([realgud-trepan-xpy],[1.0.0],[]) AC_CONFIG_SRCDIR(trepan-xpy/trepan-xpy.el) AM_INIT_AUTOMAKE([foreign]) AM_MAINTAINER_MODE AC_PATH_PROG([EMACS], [emacs], [emacs]) -AC_ARG_WITH(emacs, AC_HELP_STRING([--with-emacs], - [location of emacs program]), EMACS=$withval) +AC_ARG_WITH(emacs, AS_HELP_STRING([--with-emacs],[location of emacs program]), EMACS=$withval) AC_MSG_NOTICE("Checking emacs version") $EMACS -batch -q --no-site-file -eval \ diff --git a/test/test-regexp-trepan-xpy.el b/test/test-regexp-trepan-xpy.el new file mode 100644 index 0000000000..db3947bccf --- /dev/null +++ b/test/test-regexp-trepan-xpy.el @@ -0,0 +1,108 @@ +;; Press C-x C-e at the end of the next line to run this file test non-interactively +;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory (locate-library "test-simple.elc")) buffer-file-name) + +(require 'test-simple) +(load-file "../trepan-xpy/init.el") +(load-file "./regexp-helper.el") + +(declare-function __FILE__ 'load-relative) +(declare-function loc-match 'realgud-helper) +(declare-function prompt-match 'regexp-helper) +(declare-function realgud-loc-pat-file-group 'realgud-regexp) +(declare-function realgud-loc-pat-line-group 'realgud-regexp) + +(test-simple-start) + +(eval-when-compile + (defvar loc-pat) (defvar prompt-pat) (defvar realgud:trepan-xpy-pat-hash) + (defvar tb-pat) (defvar test-text) (defvar prompt-str) + (defvar bps-pat) +) + +(set (make-local-variable 'bps-pat) + (gethash "brkpt-set" realgud:trepan-xpy-pat-hash)) + +(set (make-local-variable 'loc-pat) + (gethash "loc" realgud:trepan-xpy-pat-hash)) + +(set (make-local-variable 'prompt-pat) + (gethash "prompt" realgud:trepan-xpy-pat-hash)) + +(set (make-local-variable 'tb-pat) + (gethash "lang-backtrace" realgud:trepan-xpy-pat-hash)) + +;; FIXME: we get a void variable somewhere in here when running +;; even though we define it in lexical-let. Dunno why. +;; setq however will workaround this. +(setq test-text + " File \"/usr/lib/python2.6/code.py\", line 281, in raw_input") +(note "traceback location matching") + +(assert-t (numberp (loc-match test-text tb-pat)) "basic traceback location") + +(assert-equal "/usr/lib/python2.6/code.py" + (match-string (realgud-loc-pat-file-group tb-pat) + test-text)) + +(setq test-text + " File \"/usr/lib/python2.6/code.py\", line 281, in raw_input") +(loc-match test-text tb-pat) +(assert-equal "281" + (match-string (realgud-loc-pat-line-group tb-pat) + test-text) "extract line number") + +(note "breakpoint location matching") + +(setq test-text "Breakpoint 1 at /src/git/code/gcd.py:13") +(assert-t (numberp (loc-match test-text bps-pat)) + "basic breakpoint location") + +(assert-equal "/src/git/code/gcd.py" + (match-string (realgud-loc-pat-file-group + bps-pat) + test-text) + "extract breakpoint file name") + + +(assert-equal "13" + (match-string (realgud-loc-pat-line-group + bps-pat) + test-text) "extract breakpoint line number") + +;; (set test-text "(c:\\working\\python\\helloworld.py:30): <module>") +;; +;; (assert-t (numberp (loc-match test-text loc-pat)) "MS DOS position location") +;; ;; +;; (assert-equal "c:\\working\\python\\helloworld.py" +;; (match-string (realgud-loc-pat-file-group loc-pat) +;; test-text) +;; (format "Failing file group is %s" +;; (realgud-loc-pat-file-group tb-pat)) +;; "extract file name") +;; (assert-equal "30" +;; (match-string (realgud-loc-pat-line-group loc-pat) +;; test-text) "extract line number") + +(setq test-text "> /usr/bin/ipython(24)<module>") +(assert-t (numberp (loc-match test-text loc-pat)) "position location") +(assert-equal "/usr/bin/ipython" + (match-string (realgud-loc-pat-file-group loc-pat) + test-text) + (format "Failing file group is %s" + (realgud-loc-pat-file-group tb-pat))) +(assert-equal "24" + (match-string (realgud-loc-pat-line-group + loc-pat) + test-text) + "extract line number") + + +(note "prompt matching") +(set (make-local-variable 'prompt-str) "trepan-xpy> ") +(prompt-match prompt-str nil "debugger prompt: %s") +(setq prompt-str "trepan-xpy") +(assert-nil (numberp (loc-match prompt-str prompt-pat)) + (format "%s %s" "invalid debugger prompt" + prompt-str)) + +(end-tests) diff --git a/test/test-trepan-xpy.el b/test/test-trepan-xpy.el new file mode 100644 index 0000000000..b9b3bc693f --- /dev/null +++ b/test/test-trepan-xpy.el @@ -0,0 +1,40 @@ +;; Press C-x C-e at the end of the next line to run this file test non-interactively +;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory (locate-library "test-simple.elc")) buffer-file-name) + +(require 'test-simple) +(require 'load-relative) +(load-file "../trepan-xpy/trepan-xpy.el") + +(eval-when-compile (defvar test:run-process-save)) + +(declare-function trepan-xpy-parse-cmd-args 'realgud:trepan-xpy-core) +(declare-function realgud:trepan-xpy 'realgud:trepan-xpy) +(declare-function __FILE__ 'load-relative) + +(test-simple-start) + +;; Save value realgud:run-process and change it to something we want +(setq test:run-process-save (symbol-function 'realgud:run-process)) +(defun realgud:run-process(debugger-name script-filename cmd-args + minibuffer-histroy &optional no-reset) + "Fake realgud:run-process used in testing" + (note + (format "%s %s %s" debugger-name script-filename cmd-args)) + (assert-equal "trepan-xpy" debugger-name "debugger name gets passed") + (assert-equal (expand-file-name "./gcd.py") script-filename "file name check") + (assert-equal '("3" "5") (cddr cmd-args) "command args listified") + (generate-new-buffer "*cmdbuf-test*") + ) + +(note "trepan-xpy-parse-cmd-args") +(assert-equal (list nil '("trepan-xpy") (list (expand-file-name "foo")) nil) + (trepan-xpy-parse-cmd-args '("trepan-xpy" "foo"))) +(assert-equal (list nil '("trepan-xpy") (list (expand-file-name "program.py") "foo") nil) + (trepan-xpy-parse-cmd-args + '("trepan-xpy" "program.py" "foo"))) + +(realgud:trepan-xpy "trepan-xpy ./gcd.py 3 5") +;; Restore the old value of realgud:run-process +(fset 'realgud:run-process test:run-process-save) + +(end-tests) diff --git a/trepan-xpy/trepan-xpy.el b/trepan-xpy/trepan-xpy.el index 287ddf3530..ef964231d6 100644 --- a/trepan-xpy/trepan-xpy.el +++ b/trepan-xpy/trepan-xpy.el @@ -1,4 +1,4 @@ -;; Copyright (C) 2010-2014, 2016-2017 Free Software Foundation, Inc +;; Copyright (C) 2010-2014, 2016-2017, 2023 Free Software Foundation, Inc ;; Author: Rocky Bernstein <ro...@gnu.org>