Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf0da725

Browse files
authored
fix: annotate multi-words fields (#116)
1 parentdd15752 commitf0da725

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

‎provider/decode_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package provider_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/coder/terraform-provider-coder/provider"
7+
"github.com/mitchellh/mapstructure"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
funcTestDecode(t*testing.T) {
12+
const (
13+
legacyVariable="Legacy Variable"
14+
legacyVariableName="Legacy Variable Name"
15+
)
16+
17+
aMap:=map[string]interface{}{
18+
"name":"Parameter Name",
19+
"legacy_variable":legacyVariable,
20+
"legacy_variable_name":legacyVariableName,
21+
}
22+
23+
varparam provider.Parameter
24+
err:=mapstructure.Decode(aMap,&param)
25+
require.NoError(t,err)
26+
require.Equal(t,legacyVariable,param.LegacyVariable)
27+
require.Equal(t,legacyVariableName,param.LegacyVariableName)
28+
}

‎provider/parameter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ type Parameter struct {
5151
Validation []Validation
5252
Optionalbool
5353

54-
LegacyVariableNamestring
55-
LegacyVariablestring
54+
LegacyVariableNamestring`mapstructure:"legacy_variable_name"`
55+
LegacyVariablestring`mapstructure:"legacy_variable"`
5656
}
5757

5858
funcparameterDataSource()*schema.Resource {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp