Il giorno sabato 23 novembre 2013, Aslak Hellesøy ha scritto:

> In core/src/main/java/cucumber/api/DataTable.java:
>
> > @@ -187,6 +213,29 @@ public TableConverter getTableConverter() {
> >          }
> >          return result;
> >      }
> > +
> > +    public DataTable transpose() {
> > +    	List<List<String>> transposed = new ArrayList<List<String>>();
> > +        for (int i = 0; i < gherkinRows.size(); i++) {
> > +	        Row gherkinRow = gherkinRows.get(i);
> > +	        for (int j = 0; j < gherkinRow.getCells().size(); j++) {
> > +	            List<String> row = null;
> > +	            if (j < transposed.size()) {
> > +	                row = transposed.get(j);
> > +	            }
> > +	            if (row == null) {
> > +	                row = new ArrayList<String>();
> > +	                transposed.add(row);
> > +	            }
> > +	            // fixes non rectangular tables
>
> Non-rectangular tables should throw an error. Please add a test that
> verifies that an error is thrown.
>
Do we want an exception get generated for all of the following?

# scenario 1
| a | b | c | d |
| a | b |

#scenario 2
| a | b |
| a | b | c | d |

Currently these 2 scenarios do not generate an error if the table is not
transposed, that's the reason for my lenient implementation.

—
> Reply to this email directly or view it on GitHub<https://github.com/cucumber/cucumber-jvm/pull/635/files#r7874915>
> .
>