-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiletmpl_test.go
More file actions
30 lines (22 loc) · 868 Bytes
/
filetmpl_test.go
File metadata and controls
30 lines (22 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2017, 2018 Damon Revoe. All rights reserved.
// Use of this source code is governed by the MIT
// license, which can be found in the LICENSE file.
package main
import (
"testing"
)
func runTemplateFunctionTest(t *testing.T, funcName, arg, expected string) {
result := commonFuncMap[funcName].(func(string) string)(arg)
if result != expected {
t.Error("Error: \"" + result + "\" != \"" + expected + "\"")
}
}
func TestTemplateFunctions(t *testing.T) {
runTemplateFunctionTest(t, "VarName", "C++11", "Cxx11")
runTemplateFunctionTest(t, "VarName", "one-half", "one_half")
runTemplateFunctionTest(t, "VarNameUC", "C++11", "CXX11")
runTemplateFunctionTest(t, "VarNameUC",
"cross-country", "CROSS_COUNTRY")
runTemplateFunctionTest(t, "LibName", "libc++11", "libc++11")
runTemplateFunctionTest(t, "LibName", "dash-dot.", "dash-dot.")
}