Skip to content

Commit 9616fd0

Browse files
committed
Fix method-name fontification tests.
Restore incorrectly removed utility function.
1 parent c206dbc commit 9616fd0

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

csharp-mode-tests.el

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070
;; this replaces the manual test of
7171
;; test-files/fontification-test-compiler-directives.cs, but file
7272
;; has been kept around to assist manual testing/verification.
73+
(assess-face-in-file= "test-files/fontification-test-compiler-directives.cs"
74+
"strReference" 'font-lock-string-face
75+
"strVerification" 'font-lock-string-face
76+
"singleQuote" 'font-lock-string-face
77+
"doubleQuote" 'font-lock-string-face)
78+
7379
(assess-face-in-text=
7480
"#region test\nbool bar = true;"
7581
;; should not be interpreted as string because of trailing \!
@@ -91,13 +97,18 @@
9197
)))
9298

9399
(ert-deftest fontification-of-compiler-directives-after-comments ()
94-
;; this replaces the manual test of
95-
;; test-files/fontification-test-compiler-directives-with-comments.cs, but file
96-
;; has been kept around to assist manual testing/verification.
97100
(assess-face-in-file= "./test-files/fontification-test-compiler-directives-with-comments.cs"
98101
"case1" 'font-lock-comment-face
99102
"case2" 'font-lock-comment-face))
100103

104+
(ert-deftest fontification-of-method-names ()
105+
(assess-face-in-file= "./test-files/imenu-method-test.cs"
106+
"OpenWebServicesAsync" 'font-lock-function-name-face
107+
"ToString" 'font-lock-function-name-face
108+
"Equals" 'font-lock-function-name-face
109+
"AbstractMethod" 'font-lock-function-name-face
110+
"UnsafeCopy" 'font-lock-function-name-face))
111+
101112
(defun list-repeat-once (mylist)
102113
(append mylist mylist))
103114

csharp-mode.el

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,20 @@ to work properly with code that includes attributes.
511511
)))
512512

513513

514+
(defun csharp-is-square-parentasis-block-p ()
515+
"Attempts to safely assess if the current point is at the opening of
516+
a square parentasis block [ ... ]."
517+
(let* ((start (point)) ;; variables used to hold our position, so that we know that
518+
(end)) ;; our code isn't stuck trying to look for a non-existant sexp.
519+
(and (eq (char-after) 91) ;; open square
520+
(while (and (eq (char-after) 91)
521+
(not (eq start end)))
522+
(c-safe (c-forward-sexp 1))
523+
(setq end (point)))
524+
(eq (char-before) 93))) ;; close square
525+
)
526+
527+
514528
;; ==================================================================
515529
;; end of csharp-mode utility and feature defuns
516530
;; ==================================================================

test-files/fontification-test-compiler-directives.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ public void Test()
77
string x;
88

99
// reference
10-
x += "foo";
10+
x += "strReference";
1111
#region v1 verification
12-
x += "foo";
12+
x += "strVerification";
1313
#endregion
1414

1515
#region t1 test'
16-
x += "foo";
16+
x += "singleQuote";
1717
#endregion
1818

1919
#region t2 - test"
20-
x += "foo";
20+
x += "doubleQuote";
2121
#endregion
2222
}
2323
}

0 commit comments

Comments
 (0)