alex-kar commented on PR #149:
URL: https://github.com/apache/iceberg-go/pull/149#issuecomment-2351750960

   Also I tried to write something like "parameterized" test to provide 
different test cases, but not sure if arguments are readable.
   Here is the idea:
   ```
   var testArgs = []struct {
        meta     string
        expected string
   }{
        {`<metadata json 1>`, `<expecte output 1>`},
        {`<metadata json 2>`, `<expecte output 2>`},
        {`<metadata json 3>`, `<expecte output 3>`},
   }
   
   func TestDescribeTable(t *testing.T) {
        var buf bytes.Buffer
        pterm.SetDefaultOutput(&buf)
        pterm.DisableColor()
        for _, tt := range testArgs {
                meta, _ := table.ParseMetadataBytes([]byte(tt.meta))
                table := table.New([]string{"t"}, meta, "", nil)
   
                text{}.DescribeTable(table)
   
                testza.AssertEqual(t, tt.expected, buf.String())
        }
   }
   ```
   But because "metadata json" and "expected output" are quite long multiline 
strings, it make arguments less readable.
   
   @zeroshade WDYT? Is it better to just write separate tests for each case or 
go with different parameters for the same test?
   However, if we use parameters, we won't be able to reuse `Examples`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to