mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-07 06:10:36 +00:00
Fixing more spelling
This commit is contained in:
parent
0754211914
commit
bc34216afe
@ -22,7 +22,7 @@ see https://yaml.org/type/merge.html
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- &CENTER
|
- &CENTRE
|
||||||
x: 1
|
x: 1
|
||||||
y: 2
|
y: 2
|
||||||
- &LEFT
|
- &LEFT
|
||||||
@ -32,7 +32,7 @@ Given a sample.yml file of:
|
|||||||
r: 10
|
r: 10
|
||||||
- &SMALL
|
- &SMALL
|
||||||
r: 1
|
r: 1
|
||||||
- !!merge <<: *CENTER
|
- !!merge <<: *CENTRE
|
||||||
r: 10
|
r: 10
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
@ -288,7 +288,7 @@ see https://yaml.org/type/merge.html. This has the correct data, but the wrong k
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- &CENTER
|
- &CENTRE
|
||||||
x: 1
|
x: 1
|
||||||
y: 2
|
y: 2
|
||||||
- &LEFT
|
- &LEFT
|
||||||
@ -299,7 +299,7 @@ Given a sample.yml file of:
|
|||||||
- &SMALL
|
- &SMALL
|
||||||
r: 1
|
r: 1
|
||||||
- !!merge <<:
|
- !!merge <<:
|
||||||
- *CENTER
|
- *CENTRE
|
||||||
- *BIG
|
- *BIG
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
@ -318,7 +318,7 @@ see https://yaml.org/type/merge.html. This has the correct data, but the wrong k
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- &CENTER
|
- &CENTRE
|
||||||
x: 1
|
x: 1
|
||||||
y: 2
|
y: 2
|
||||||
- &LEFT
|
- &LEFT
|
||||||
@ -401,7 +401,7 @@ Taken from https://yaml.org/type/merge.html. Same values as legacy, but with the
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- &CENTER
|
- &CENTRE
|
||||||
x: 1
|
x: 1
|
||||||
y: 2
|
y: 2
|
||||||
- &LEFT
|
- &LEFT
|
||||||
@ -412,7 +412,7 @@ Given a sample.yml file of:
|
|||||||
- &SMALL
|
- &SMALL
|
||||||
r: 1
|
r: 1
|
||||||
- !!merge <<:
|
- !!merge <<:
|
||||||
- *CENTER
|
- *CENTRE
|
||||||
- *BIG
|
- *BIG
|
||||||
```
|
```
|
||||||
then
|
then
|
||||||
@ -432,7 +432,7 @@ Taken from https://yaml.org/type/merge.html. Same values as legacy, but with the
|
|||||||
|
|
||||||
Given a sample.yml file of:
|
Given a sample.yml file of:
|
||||||
```yaml
|
```yaml
|
||||||
- &CENTER
|
- &CENTRE
|
||||||
x: 1
|
x: 1
|
||||||
y: 2
|
y: 2
|
||||||
- &LEFT
|
- &LEFT
|
||||||
|
|||||||
@ -45,8 +45,8 @@ func (te *tomlEncoder) Encode(writer io.Writer, node *CandidateNode) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if te.prefs.ColorsEnabled {
|
if te.prefs.ColorsEnabled {
|
||||||
colorized := te.colorizeToml(buf.Bytes())
|
colourised := te.colorizeToml(buf.Bytes())
|
||||||
_, err := writer.Write(colorized)
|
_, err := writer.Write(colourised)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ func (te *tomlEncoder) colorizeToml(input []byte) []byte {
|
|||||||
boolColor := color.New(color.FgHiMagenta).SprintFunc()
|
boolColor := color.New(color.FgHiMagenta).SprintFunc()
|
||||||
sectionColor := color.New(color.FgYellow, color.Bold).SprintFunc()
|
sectionColor := color.New(color.FgYellow, color.Bold).SprintFunc()
|
||||||
|
|
||||||
// Simple tokenization for TOML coloring
|
// Simple tokenization for TOML colouring
|
||||||
i := 0
|
i := 0
|
||||||
for i < len(toml) {
|
for i < len(toml) {
|
||||||
ch := toml[i]
|
ch := toml[i]
|
||||||
|
|||||||
@ -695,14 +695,14 @@ func TestTomlColorisationNumberBug(t *testing.T) {
|
|||||||
encoder := NewTomlEncoder()
|
encoder := NewTomlEncoder()
|
||||||
tomlEncoder := encoder.(*tomlEncoder)
|
tomlEncoder := encoder.(*tomlEncoder)
|
||||||
|
|
||||||
// Test case that exposes the bug: "123-+-45" should NOT be colorized as a single number
|
// Test case that exposes the bug: "123-+-45" should NOT be colourised as a single number
|
||||||
input := "A = 123-+-45\n"
|
input := "A = 123-+-45\n"
|
||||||
result := string(tomlEncoder.colorizeToml([]byte(input)))
|
result := string(tomlEncoder.colorizeToml([]byte(input)))
|
||||||
|
|
||||||
// The bug causes "123-+-45" to be colorized as one token
|
// The bug causes "123-+-45" to be colourised as one token
|
||||||
// It should stop at "123" because the next character '-' is not valid in this position
|
// It should stop at "123" because the next character '-' is not valid in this position
|
||||||
if strings.Contains(result, "123-+-45") {
|
if strings.Contains(result, "123-+-45") {
|
||||||
// Check if it's colorized as a single token (no color codes in the middle)
|
// Check if it's colourised as a single token (no color codes in the middle)
|
||||||
idx := strings.Index(result, "123-+-45")
|
idx := strings.Index(result, "123-+-45")
|
||||||
// Look backwards for color code
|
// Look backwards for color code
|
||||||
beforeIdx := idx - 1
|
beforeIdx := idx - 1
|
||||||
@ -722,8 +722,8 @@ func TestTomlColorisationNumberBug(t *testing.T) {
|
|||||||
|
|
||||||
if beforeIdx >= 0 && hasResetAfter {
|
if beforeIdx >= 0 && hasResetAfter {
|
||||||
// The entire "123-+-45" is wrapped in color codes - this is the bug!
|
// The entire "123-+-45" is wrapped in color codes - this is the bug!
|
||||||
t.Errorf("BUG DETECTED: '123-+-45' is incorrectly colorized as a single number")
|
t.Errorf("BUG DETECTED: '123-+-45' is incorrectly colourised as a single number")
|
||||||
t.Errorf("Expected only '123' to be colorized as a number, but got the entire '123-+-45'")
|
t.Errorf("Expected only '123' to be colourised as a number, but got the entire '123-+-45'")
|
||||||
t.Logf("Full output: %q", result)
|
t.Logf("Full output: %q", result)
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
@ -740,13 +740,13 @@ func TestTomlColorisationNumberBug(t *testing.T) {
|
|||||||
name: "consecutive minuses",
|
name: "consecutive minuses",
|
||||||
input: "A = 123--45\n",
|
input: "A = 123--45\n",
|
||||||
invalidSequence: "123--45",
|
invalidSequence: "123--45",
|
||||||
description: "'123--45' should not be colorized as a single number",
|
description: "'123--45' should not be colourised as a single number",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "plus in middle",
|
name: "plus in middle",
|
||||||
input: "A = 123+45\n",
|
input: "A = 123+45\n",
|
||||||
invalidSequence: "123+45",
|
invalidSequence: "123+45",
|
||||||
description: "'123+45' should not be colorized as a single number",
|
description: "'123+45' should not be colourised as a single number",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,7 +791,7 @@ func TestTomlColorisationNumberBug(t *testing.T) {
|
|||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
result := tomlEncoder.colorizeToml([]byte(tt.input))
|
result := tomlEncoder.colorizeToml([]byte(tt.input))
|
||||||
if len(result) == 0 {
|
if len(result) == 0 {
|
||||||
t.Error("Expected non-empty colorized output")
|
t.Error("Expected non-empty colourised output")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -816,7 +816,7 @@ func TestTomlStringEscapeColourization(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "escaped quote at end",
|
name: "escaped quote at end",
|
||||||
input: `A = "test\""` + "\n",
|
input: `A = "test\""` + "\n",
|
||||||
description: "String ending with escaped quote should be colorized correctly",
|
description: "String ending with escaped quote should be colourised correctly",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "escaped backslash then quote",
|
name: "escaped backslash then quote",
|
||||||
@ -826,7 +826,7 @@ func TestTomlStringEscapeColourization(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "escaped quote in middle",
|
name: "escaped quote in middle",
|
||||||
input: `A = "test\"middle"` + "\n",
|
input: `A = "test\"middle"` + "\n",
|
||||||
description: "String with escaped quote in the middle should be colorized correctly",
|
description: "String with escaped quote in the middle should be colourised correctly",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "multiple escaped quotes",
|
name: "multiple escaped quotes",
|
||||||
@ -836,7 +836,7 @@ func TestTomlStringEscapeColourization(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "escaped newline",
|
name: "escaped newline",
|
||||||
input: `A = "test\n"` + "\n",
|
input: `A = "test\n"` + "\n",
|
||||||
description: "String with escaped newline should be colorized correctly",
|
description: "String with escaped newline should be colourised correctly",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "single quote with escaped single quote",
|
name: "single quote with escaped single quote",
|
||||||
@ -850,7 +850,7 @@ func TestTomlStringEscapeColourization(t *testing.T) {
|
|||||||
// The test should not panic and should return some output
|
// The test should not panic and should return some output
|
||||||
result := tomlEncoder.colorizeToml([]byte(tt.input))
|
result := tomlEncoder.colorizeToml([]byte(tt.input))
|
||||||
if len(result) == 0 {
|
if len(result) == 0 {
|
||||||
t.Error("Expected non-empty colorized output")
|
t.Error("Expected non-empty colourised output")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that the result contains the input string (with color codes)
|
// Check that the result contains the input string (with color codes)
|
||||||
|
|||||||
@ -277,3 +277,4 @@ nohcl
|
|||||||
zclconf
|
zclconf
|
||||||
cty
|
cty
|
||||||
go-cty
|
go-cty
|
||||||
|
Colorisation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user