Как я эмулирую 'softtabstop' Vim в Emacs?

Другой случай, где Вы можете быть извинены за ловлю и игнорирование исключений, - когда Вы - поблочное тестирование.

public void testSomething(){
    try{
        fooThatThrowsAnException(parameterThatCausesTheException);
        fail("The method didn't throw the exception that we expected it to");
    } catch(SomeException e){
        // do nothing, as we would expect this to happen, if the code works OK.
    }
}

Примечание, что, даже при том, что блок выгоды ничего не делает, оно объясняет почему.

сказавший это, более свежие среды тестирования (Junit4 & TestNG), позволяют Вам определять исключение, которое ожидается - который приводит к чему-то как это...

@Test(expected = SomeException.class)
public void testSomething(){
    fooThatThrowsAnException(parameterThatCausesTheException);
    fail("The method didn't throw the exception that we expected it to");
}
6
задан Luke Girvin 22 February 2012 в 21:11
поделиться

1 ответ

Это работает для меня, где 'tab-width используется как ширина столбцов. Задайте ключ в соответствующих таблицах ...

(local-set-key (kbd "DEL") 'backward-delete-whitespace-to-column)
(defun backward-delete-whitespace-to-column ()
  "delete back to the previous column of whitespace, or as much whitespace as possible,
or just one char if that's not possible"
  (interactive)
  (if indent-tabs-mode
      (call-interactively 'backward-delete-char-untabify)
    (let ((movement (% (current-column) tab-width))
          (p (point)))
      (when (= movement 0) (setq movement tab-width))
      (save-match-data
        (if (string-match "\\w*\\(\\s-+\\)$" (buffer-substring-no-properties (- p movement) p))
            (backward-delete-char-untabify (- (match-end 1) (match-beginning 1)))
        (call-interactively 'backward-delete-char-untabify))))))
7
ответ дан 11 December 2019 в 00:40
поделиться