MCPcopy
hub / github.com/hashicorp/hcl / TestBodySetAttributeValue

Function TestBodySetAttributeValue

hclwrite/ast_body_test.go:348–544  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

346}
347
348func TestBodySetAttributeValue(t *testing.T) {
349 tests := []struct {
350 src string
351 name string
352 val cty.Value
353 want Tokens
354 }{
355 {
356 "",
357 "a",
358 cty.True,
359 Tokens{
360 {
361 Type: hclsyntax.TokenIdent,
362 Bytes: []byte{'a'},
363 SpacesBefore: 0,
364 },
365 {
366 Type: hclsyntax.TokenEqual,
367 Bytes: []byte{'='},
368 SpacesBefore: 1,
369 },
370 {
371 Type: hclsyntax.TokenIdent,
372 Bytes: []byte("true"),
373 SpacesBefore: 1,
374 },
375 {
376 Type: hclsyntax.TokenNewline,
377 Bytes: []byte{'\n'},
378 SpacesBefore: 0,
379 },
380 {
381 Type: hclsyntax.TokenEOF,
382 Bytes: []byte{},
383 SpacesBefore: 0,
384 },
385 },
386 },
387 {
388 "b = false\n",
389 "a",
390 cty.True,
391 Tokens{
392 {
393 Type: hclsyntax.TokenIdent,
394 Bytes: []byte{'b'},
395 SpacesBefore: 0,
396 },
397 {
398 Type: hclsyntax.TokenEqual,
399 Bytes: []byte{'='},
400 SpacesBefore: 1,
401 },
402 {
403 Type: hclsyntax.TokenIdent,
404 Bytes: []byte("false"),
405 SpacesBefore: 1,

Callers

nothing calls this directly

Calls 7

formatFunction · 0.85
RunMethod · 0.80
SetAttributeValueMethod · 0.80
ParseConfigFunction · 0.70
BuildTokensMethod · 0.65
ErrorMethod · 0.45
BodyMethod · 0.45

Tested by

no test coverage detected