 Path     = require 'fspath'
 
 describe 'test kevas', ->
+
+  it 'should use a noop function when not given values', ->
+
+    string = 'test {{noop}} function'
+    transform = kevas()
+
+    calledData = []
+    transform.on 'data', (data) -> calledData.push data
+    transform.end string
+
+    assert calledData.length > 0
+    for each, index in calledData
+      assert Buffer.isBuffer(each), 'index ' + index + ' isnt a buffer'
+    assert.equal Buffer.concat(calledData).toString(), string
+
+
+  it 'should use a values function when given', ->
+
+    string = 'test {{value}} function'
+    transform = kevas values: (key) -> if key is 'value' then 'VALUE'
+
+    calledData = []
+    transform.on 'data', (data) -> calledData.push data
+    transform.end string
+
+    assert calledData.length > 0
+    for each, index in calledData
+      assert Buffer.isBuffer(each), 'index ' + index + ' isnt a buffer'
+    assert.equal Buffer.concat(calledData).toString(), 'test VALUE function'
+
+
+  it 'should use a noop function when given an invalid values type', ->
+
+    string = 'test {{noop}} function'
+    transform = kevas values: 123
+
+    calledData = []
+    transform.on 'data', (data) -> calledData.push data
+    transform.end string
+
+    assert calledData.length > 0
+    for each, index in calledData
+      assert Buffer.isBuffer(each), 'index ' + index + ' isnt a buffer'
+    assert.equal Buffer.concat(calledData).toString(), string
+
+
+  it 'should leave key wrapped with braces when there\'s no value for the key', ->
+
+    string = 'test {{unknown}} function'
+    transform = kevas values: {}
+
+    calledData = []
+    transform.on 'data', (data) -> calledData.push data
+    transform.end string
+
+    assert calledData.length > 0
+    for each, index in calledData
+      assert Buffer.isBuffer(each), 'index ' + index + ' isnt a buffer'
+    assert.equal Buffer.concat(calledData).toString(), string
+
 
   shouldReplaceKeyWithValue = 'should replace the key with its value'
   for test in [

    {
      desc: 'with a single key surrouned by space'
      output:['{{ key }}']
      values: key:'value'
      result:'value'
    }
    {

      result:'some {{ value'
    }
    {
      desc: 'with an escape slash before first opening brace which voids key (1)'
      should:'should match input without key replacement'
      output:['some \\', '{{key}} value']
      values: key:'good'
      result:'some {{key}} value'
    }
    {
      desc: 'with an escape slash before first opening brace which voids key (2)'
      should:'should match input without key replacement'
      output:['some \\{', '{key}} value']
      values: key:'good'
      result:'some {{key}} value'
    }
    {
      desc: 'with two escape slashes before first opening brace which doesnt affect the key (1)'
      output:['some \\\\', '{{key}} value']
      values: key:'good'
      result:'some \\\\good value'
    }
    {
      desc: 'with two escape slashes before first opening brace which doesnt affect the key (2)'
      output:['some \\', '\\{{key}} value']
      values: key:'good'
      result:'some \\good value'
    }
    {
      desc: 'with two escape slashes before first closing brace which becomes part of the key'
      output:['some {{ke\\', '\\y}} value']
      values: 'ke\\\\y':'good'
      result:'some good value'
    }
    {
      desc: 'with escape slash at start of second chunk escaping opening braces'
      output:['some ', '\\{{key}} value']
      values: key:'good'
      result:'some {{key}} value'
    }
    {
      desc: 'with short chunk, previous slash, and slash at start of second chunk'
      should:'should escape slash and still match key'
      output:['some \\', '\\{', '{key}} value']
      values: key:'good'
      result:'some \\good value'
    }
    {
      desc: 'with lots of output chunks'
      should:'should still escape a brace and match proper key'
