Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: generic

env:
matrix:
- EMACS=emacs23
- EMACS=emacs24
- EMACS=emacs-snapshot

install:
- if [ "$EMACS" = 'emacs23' ]; then
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs23-gtk emacs23-el;
fi
- if [ "$EMACS" = 'emacs24' ]; then
sudo add-apt-repository -y ppa:cassou/emacs &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs24 emacs24-el;
fi
- if [ "$EMACS" = 'emacs-snapshot' ]; then
sudo add-apt-repository -y ppa:ubuntu-elisp/ppa &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs-snapshot &&
sudo apt-get -qq install emacs-snapshot-el;
fi

# Emacs 23 does not come with ERT. Download it and have emacs find it
before_script:
- if [ "$EMACS" = 'emacs23' ]; then
curl -Os https://raw.githubusercontent.com/ohler/ert/c619b56c5bc6a866e33787489545b87d79973205/lisp/emacs-lisp/ert.el &&
export EMACSLOADPATH=$(emacs -batch -eval "(princ (mapconcat 'identity load-path \":\"))") &&
export EMACSLOADPATH="$EMACSLOADPATH:$PWD";
fi

script:
- ./run_rust_emacs_tests.sh

notifications:
email: false
28 changes: 15 additions & 13 deletions rust-mode-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ fn bar() { }" 14 67))
"/**
*
*/"
8
"This is a very very very very very very very long string"
7
" This is a very very very very very very very long string"
"/**
* This is a very very very very
* very very very long string
Expand Down Expand Up @@ -317,8 +317,7 @@ fn foo() {
/*!
* this is a nested doc comment
*/

//! And so is this
\n //! And so is this
}"))

(ert-deftest indent-inside-braces ()
Expand Down Expand Up @@ -617,7 +616,10 @@ fn indented_already() {
POS-SYMBOL is a symbol found in `rust-test-positions-alist'.
Convert the line-column information from that list into a buffer position value."
(interactive "P")
(pcase-let ((`(,line ,column) (cadr (assoc pos-symbol rust-test-positions-alist))))
(let* (
(line-and-column (cadr (assoc pos-symbol rust-test-positions-alist)))
(line (nth 0 line-and-column))
(column (nth 1 line-and-column)))
(save-excursion
(goto-line line)
(move-to-column column)
Expand Down Expand Up @@ -845,14 +847,14 @@ All positions are position symbols found in `rust-test-positions-alist'."
(defun rust-test-group-str-by-face (str)
"Fontify `STR' in rust-mode and group it by face, returning a
list of substrings of `STR' each followed by its face."
(cl-loop with fontified = (rust-test-fontify-string str)
for start = 0 then end
while start
for end = (next-single-property-change start 'face fontified)
for prop = (get-text-property start 'face fontified)
for text = (substring-no-properties fontified start end)
if prop
append (list text prop)))
(loop with fontified = (rust-test-fontify-string str)
for start = 0 then end
while start
for end = (next-single-property-change start 'face fontified)
for prop = (get-text-property start 'face fontified)
for text = (substring-no-properties fontified start end)
if prop
append (list text prop)))

(defun rust-test-font-lock (source face-groups)
"Test that `SOURCE' fontifies to the expected `FACE-GROUPS'"
Expand Down