Skip to content

Commit

Permalink
Add test case for proper csv escaping
Browse files Browse the repository at this point in the history
I generated the _test.go.{csv,json} files by using a version of ginkgo
built from the next commit.

If tests are run on this sha, they are expected to fail; the next
commit fixes them.
  • Loading branch information
belden authored and onsi committed Dec 19, 2024
1 parent 43dad69 commit 96a80fc
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
14 changes: 14 additions & 0 deletions ginkgo/outline/_testdata/csv_proper_escaping_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package example_test

import (
. "github.com/onsi/ginkgo/v2"
)

var _ = Describe("Abnormal\"Fixture", func() {
When("four random words: flown, authenticating, semiweekly, and overproduction", func() {
It("has a dangling double-quote here: \"", func() {
By("step 1")
By("step 2")
})
})
})
6 changes: 6 additions & 0 deletions ginkgo/outline/_testdata/csv_proper_escaping_test.go.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,"Abnormal""Fixture",73,300,false,false,false,
When,"four random words: flown, authenticating, semiweekly, and overproduction",113,297,false,false,false,
It,"has a dangling double-quote here: """,205,293,true,false,false,
By,step 1,260,272,false,false,false,
By,step 2,276,288,false,false,false,
1 change: 1 addition & 0 deletions ginkgo/outline/_testdata/csv_proper_escaping_test.go.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"name":"Describe","text":"Abnormal\"Fixture","start":73,"end":300,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"When","text":"four random words: flown, authenticating, semiweekly, and overproduction","start":113,"end":297,"spec":false,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"It","text":"has a dangling double-quote here: \"","start":205,"end":293,"spec":true,"focused":false,"pending":false,"labels":[],"nodes":[{"name":"By","text":"step 1","start":260,"end":272,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]},{"name":"By","text":"step 2","start":276,"end":288,"spec":false,"focused":false,"pending":false,"labels":null,"nodes":[]}]}]}]}]
4 changes: 2 additions & 2 deletions ginkgo/outline/_testdata/position_test.go.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Name,Text,Start,End,Spec,Focused,Pending,Labels
Describe,104,240,104,240,false,false,false,""
It,209,236,209,236,true,false,false,""
Describe,"104,240",104,240,false,false,false,
It,"209,236",209,236,true,false,false,
1 change: 1 addition & 0 deletions ginkgo/outline/outline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var _ = DescribeTable("Validate outline from file with",
Entry("core dsl import", "dsl_core_test.go", "dsl_core_test.go.json", "dsl_core_test.go.csv"),
Entry("labels decorator on containers and specs", "labels_test.go", "labels_test.go.json", "labels_test.go.csv"),
Entry("pending decorator on containers and specs", "pending_decorator_test.go", "pending_decorator_test.go.json", "pending_decorator_test.go.csv"),
Entry("proper csv escaping of all fields", "csv_proper_escaping_test.go", "csv_proper_escaping_test.go.json", "csv_proper_escaping_test.go.csv"),
)

var _ = Describe("Validate position", func() {
Expand Down

0 comments on commit 96a80fc

Please sign in to comment.