mirror of
https://github.com/fatedier/frp.git
synced 2025-04-25 17:21:27 +00:00
Compare commits
1 Commits
5126f2401f
...
aafc026dc7
Author | SHA1 | Date | |
---|---|---|---|
|
aafc026dc7 |
@ -18,10 +18,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"text/template"
|
|
||||||
|
|
||||||
toml "github.com/pelletier/go-toml/v2"
|
toml "github.com/pelletier/go-toml/v2"
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
@ -112,29 +112,6 @@ func TestLoadServerConfigStrictMode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRenderWithTemplate(t *testing.T) {
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
content string
|
|
||||||
want string
|
|
||||||
}{
|
|
||||||
{"toml", tomlServerContent, tomlServerContent},
|
|
||||||
{"yaml", yamlServerContent, yamlServerContent},
|
|
||||||
{"json", jsonServerContent, jsonServerContent},
|
|
||||||
{"template numeric", `key = {{ 123 }}`, "key = 123"},
|
|
||||||
{"template string", `key = {{ "xyz" }}`, "key = xyz"},
|
|
||||||
{"template quote", `key = {{ printf "%q" "with space" }}`, `key = "with space"`},
|
|
||||||
}
|
|
||||||
for _, test := range tests {
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
|
||||||
require := require.New(t)
|
|
||||||
got, err := RenderWithTemplate([]byte(test.content), nil)
|
|
||||||
require.NoError(err)
|
|
||||||
require.EqualValues(test.want, string(got))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCustomStructStrictMode(t *testing.T) {
|
func TestCustomStructStrictMode(t *testing.T) {
|
||||||
require := require.New(t)
|
require := require.New(t)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user