-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error message when missing -H or in BEGIN (#239)
Fixes #238
- Loading branch information
Showing
2 changed files
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1797,7 +1797,9 @@ var csvTests = []csvTest{ | |
{`BEGIN { INPUTMODE="csv" } { print $1, $3 }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "name age\nBob 42\nJane 37\n", "", nil}, | ||
{`BEGIN { INPUTMODE="csv header" } { print @"age", @"name" }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "42 Bob\n37 Jane\n", "", nil}, | ||
{`BEGIN { INPUTMODE="csv header" } { x="name"; print @"age", @x }`, "name,age\nBob,42", "42 Bob\n", "", nil}, | ||
{`BEGIN { INPUTMODE="csv" } { print @"age", @"name" }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "", `@ only supported if header parsing enabled; use -H or add "header" to INPUTMODE`, nil}, | ||
{`BEGIN { INPUTMODE="csv" } { print @"age", @"name" }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "", `no field names for @; use -H or add "header" to INPUTMODE, and use "getline" first if in BEGIN`, nil}, | ||
{`BEGIN { INPUTMODE="csv header"; print @"age", @"name" }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "", `no field names for @; use -H or add "header" to INPUTMODE, and use "getline" first if in BEGIN`, nil}, | ||
{`BEGIN { INPUTMODE="csv header"; getline; print @"age", @"name" }`, "name,email,age\nBob,[email protected],42\nJane,[email protected],37", "42 Bob\n", "", nil}, | ||
{`BEGIN { INPUTMODE="tsv header" } { print $1, $3 }`, "name\temail\tage\nBob,Smith\t[email protected]\t42\nJane\t[email protected]\t37", "Bob,Smith 42\nJane 37\n", "", nil}, | ||
|
||
// OUTPUTMODE combinations | ||
|