github.com/gocaveman/caveman@v0.0.0-20191211162744-0ddf99dbdf6e/i18n/processor_test.go (about)

     1  package i18n
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestProcessor(t *testing.T) {
    11  
    12  	assert := assert.New(t)
    13  
    14  	p := NewDefaultProcessor()
    15  
    16  	sout, err := p.Process("This is some text with {{.Value \"SOMETHING\"}} in it.",
    17  		context.WithValue(context.Background(), "SOMETHING", "hot sauce"))
    18  
    19  	assert.NoError(err)
    20  	assert.Equal("This is some text with hot sauce in it.", sout)
    21  
    22  }