         document.setLanguage(language)
         assert.equal(null, document.rootNode())
 
-  describe "setInput", ->
+  describe "::setInput(input)", ->
+    describe "when the language has been set", ->
+      beforeEach ->
+        document.setLanguage(language)
+
+      it "parses the input", ->
+        document.setInput({
+          read: ->
+            @_readIndex++
+            ["st", "u", "ff", "", ""][@_readIndex - 1]
+
+          seek: (n) ->
+            0
+
+          _readIndex: 0,
+        })
+
+        assert.equal("(the_rule)", document.rootNode())
+
     describe "when the supplied object does not implement #seek(n)", ->
       it "throws an exception", ->
         assert.throws((->

        })
        assert.equal(null, document.rootNode())

    describe "when the language has been set", ->
      it "parses the input", ->
        it "succeeds otherwise", ->
          document.setInput({
            read: ->
              @_readIndex++
              ["st", "u", "ff"][@_readIndex]

            seek: (n) ->
              0

            _readIndex: 0,
          })

          assert.equal("(the_rule)", document.rootNode())

  beforeEach ->
    document = new treeSitter.Document()

  describe "::setLanguage(language)", ->
    describe "when the supplied object is not a tree-sitter language", ->
      it "throws an exception", ->
        assert.throws((->
