File tree Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Expand file tree Collapse file tree 1 file changed +22
-11
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,6 @@ notes="./notes"
29
29
assert_output " Opening $HOME /notes"
30
30
}
31
31
32
- @test " Exits if \$ EDITOR isn't set and 'editor' doesn't exist" {
33
- unset EDITOR
34
- function type() { [ $1 != " editor" ]; } # Pretend editor doesn't exist.
35
- export -f type
36
-
37
- run $notes open test
38
-
39
- assert_failure
40
- assert_output " Please set \$ EDITOR to edit notes"
41
- }
42
-
43
32
@test " Opens the configured notes directory if set" {
44
33
run $notes open
45
34
@@ -104,4 +93,26 @@ notes="./notes"
104
93
105
94
assert_success
106
95
assert_output " Editor bin, editing $NOTES_DIRECTORY /note.md"
96
+ }
97
+
98
+ @test " Uses \$ EDITOR over 'editor' if both are available" {
99
+ # Simulate a `editor` symlink (as in Debian/Ubuntu/etc)
100
+ function editor() { echo " Editor bin, editing $* " ; }
101
+ export -f editor
102
+
103
+ run bash -c " $notes open note.md"
104
+
105
+ assert_success
106
+ assert_output " Editing $NOTES_DIRECTORY /note.md"
107
+ }
108
+
109
+ @test " Exits if \$ EDITOR isn't set and 'editor' doesn't exist" {
110
+ unset EDITOR
111
+ function type() { [ $1 != " editor" ]; } # Pretend editor doesn't exist.
112
+ export -f type
113
+
114
+ run $notes open test
115
+
116
+ assert_failure
117
+ assert_output " Please set \$ EDITOR to edit notes"
107
118
}
You can’t perform that action at this time.
0 commit comments