           """
 
           editor.setCursorBufferPosition([3,2])
-          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
-          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([3,2])
-          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([0,1])
+          expectHighlights([3,2], [0,1])
 
           editor.setCursorBufferPosition([0,1])
-          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
-          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([0,1])
-          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([3,2])
+          expectHighlights([0,1], [3,2])
 
       describe "when the tag has attributes", ->
         it "highlights the opening and closing tags", ->

          """

          editor.setCursorBufferPosition([2,2])
          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([2,2])
          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([0,1])

          editor.setCursorBufferPosition([0,7])
          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([0,1])
          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([2,2])

      describe "when the opening and closing tags are on the same line", ->
        it "highlight the opening and closing tags", ->
          buffer.setText "<test>text</test>"

          editor.setCursorBufferPosition([0,2])
          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([0,1])
          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([0,12])

          editor.setCursorBufferPosition([0,12])
          expect(editorView.underlayer.find('.bracket-matcher:visible').length).toBe 2
          expect(editorView.underlayer.find('.bracket-matcher:first').position()).toEqual editor.pixelPositionForBufferPosition([0,12])
          expect(editorView.underlayer.find('.bracket-matcher:last').position()).toEqual editor.pixelPositionForBufferPosition([0,1])

  describe "when bracket-matcher:go-to-matching-bracket is triggered", ->
    describe "when the cursor is before the starting pair", ->

          """

          editor.setCursorBufferPosition([0,0])
          expectHighlights([0,1], [3,2])

          editor.setCursorBufferPosition([0,1])
          expectHighlights([0,1], [3,2])

      describe "when on a closing tag", ->
        it "highlight the opening and closing tag", ->
