forked from DamienCassou/pillar-mode
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start implementing integration tests
- Loading branch information
1 parent
de8d504
commit 49dfc13
Showing
5 changed files
with
216 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
Feature: Fontification | ||
In order to read Pillar files easily | ||
As an author using Pillar | ||
I want to have syntax highlighting | ||
|
||
Background: | ||
Given I am in buffer "foo.pillar" | ||
And I clear the buffer | ||
And I start pillar mode | ||
|
||
Scenario: Standard text is not fontified | ||
When I insert "Some text" | ||
And I place the cursor between "t" and "e" | ||
Then current point should not be in bold | ||
|
||
Scenario: Titles are fontified | ||
When I clear the buffer | ||
And I insert "!Title" | ||
And I place the cursor between "!" and "Title" | ||
Then current point should be in bold | ||
|
||
When I clear the buffer | ||
And I insert "!!Title" | ||
And I place the cursor between "!" and "Title" | ||
Then current point should be in bold | ||
|
||
When I clear the buffer | ||
And I insert "!!!Title" | ||
And I place the cursor between "!" and "Title" | ||
Then current point should be in bold | ||
|
||
When I clear the buffer | ||
And I insert "!!!!Title" | ||
And I place the cursor between "!" and "Title" | ||
Then current point should be in bold | ||
|
||
Scenario: Bold test is fontified | ||
When I clear the buffer | ||
And I insert "Text ""is"" formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in bold | ||
And current point should have the pillar-bold-face face | ||
|
||
Scenario: Italic text is fontified | ||
When I clear the buffer | ||
And I insert "Text ''is'' formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in italic | ||
And current point should have the pillar-italic-face face | ||
|
||
Scenario: Strike-through text is fontified | ||
When I clear the buffer | ||
And I insert "Text --is-- formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in strike-through | ||
And current point should have the pillar-strikethrough-face face | ||
|
||
Scenario: Subscript text is fontified | ||
When I clear the buffer | ||
And I insert "Text @@is@@ formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should have the pillar-subscript-face face | ||
|
||
Scenario: Superscript text is fontified | ||
When I clear the buffer | ||
And I insert "Text ^^is^^ formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should have the pillar-superscript-face face | ||
|
||
Scenario: Underline text is fontified | ||
When I clear the buffer | ||
And I insert "Text __is__ formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in underline | ||
And current point should have the pillar-underlined-face face | ||
|
||
Scenario: Link text is fontified | ||
When I clear the buffer | ||
And I insert "Text *is* formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in underline | ||
And current point should have the pillar-link-face face | ||
|
||
Scenario: Embedded link text is fontified | ||
When I clear the buffer | ||
And I insert "Text +is+ formatted" | ||
And I place the cursor between "i" and "s" | ||
Then current point should be in underline | ||
And current point should have the pillar-link-embedded-face face | ||
|
||
Scenario: Monospace text is fontified | ||
When I clear the buffer | ||
And I insert "Text ==is== formatted" | ||
And I place the cursor between "i" and "s" | ||
And current point should have the pillar-monospaced-face face |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
(defun pillar-steps::faces-at-point () | ||
(let ((face (or (get-char-property (point) 'read-face-name) | ||
(get-char-property (point) 'face)))) | ||
(if (listp face) | ||
face | ||
(list face)))) | ||
|
||
(defun pillar-steps::fontify () | ||
(setq font-lock-fontify-buffer-function | ||
#'font-lock-default-fontify-buffer) | ||
(font-lock-fontify-buffer)) | ||
|
||
(defun pillar-steps::character-fontified-p (property valid-values) | ||
(pillar-steps::fontify) | ||
(cl-member-if | ||
(lambda (face) | ||
(memq (face-attribute face property nil t) valid-values)) | ||
(pillar-steps::faces-at-point))) | ||
|
||
(defun pillar-steps::character-bold-p () | ||
(pillar-steps::character-fontified-p | ||
:weight | ||
'(semi-bold bold extra-bold ultra-bold))) | ||
|
||
(Then "current point should be in bold" | ||
(lambda () | ||
(cl-assert | ||
(pillar-steps::character-bold-p) | ||
nil | ||
"Expected current point to be in bold"))) | ||
|
||
(Then "current point should not be in bold" | ||
(lambda () | ||
(cl-assert | ||
(not (pillar-steps::character-bold-p)) | ||
nil | ||
"Expected current point to be in bold"))) | ||
|
||
(Then "current point should be in italic" | ||
(lambda () | ||
(cl-assert | ||
(pillar-steps::character-italic-p) | ||
nil | ||
"Expected current point to be in italic"))) | ||
|
||
(defun pillar-steps::character-italic-p () | ||
(pillar-steps::character-fontified-p | ||
:slant | ||
'(italic oblique))) | ||
|
||
(defun pillar-steps::character-strike-through-p () | ||
(pillar-steps::character-fontified-p | ||
:strike-through | ||
'(t))) | ||
|
||
(Then "current point should be in strike-through" | ||
(lambda () | ||
(cl-assert | ||
(pillar-steps::character-strike-through-p) | ||
nil | ||
"Expected current point to be in strike-through"))) | ||
|
||
(defun pillar-steps::character-underline-p () | ||
(pillar-steps::character-fontified-p | ||
:underline | ||
'(t))) | ||
|
||
(Then "current point should be in underline" | ||
(lambda () | ||
(cl-assert | ||
(pillar-steps::character-underline-p) | ||
nil | ||
"Expected current point to be in underline"))) | ||
|
||
(Then "^current point should have the \\([-a-z]+\\) face$" | ||
(lambda (face) | ||
(pillar-steps::fontify) | ||
(cl-assert | ||
(cl-member | ||
(intern face) | ||
(pillar-steps::faces-at-point))) | ||
nil)) | ||
|
||
(When "^I start pillar mode$" | ||
(lambda () | ||
(pillar-mode))) | ||
|
||
;; Local Variables: | ||
;; eval: (flycheck-mode -1) | ||
;; End: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
(require 'f) | ||
|
||
(defvar pillar-support-path | ||
(f-dirname load-file-name)) | ||
|
||
(defvar pillar-features-path | ||
(f-parent pillar-support-path)) | ||
|
||
(defvar pillar-root-path | ||
(f-parent pillar-features-path)) | ||
|
||
|
||
(add-to-list 'load-path pillar-root-path) | ||
|
||
(require 'pillar) | ||
(require 'espuds) | ||
(require 'ert) | ||
|
||
;; Local Variables: | ||
;; eval: (flycheck-mode -1) | ||
;; End: |