urn_test.go 708 B

1234567891011121314151617181920212223242526
  1. package urn
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. )
  6. func TestUrnParse(t *testing.T) {
  7. for ii, tt := range tests {
  8. urn, err := Parse(tt.in)
  9. if ok := err == nil; ok {
  10. require.True(t, tt.ok, herror(ii, tt))
  11. require.Equal(t, tt.obj.ID, urn.ID, herror(ii, tt))
  12. require.Equal(t, tt.obj.SS, urn.SS, herror(ii, tt))
  13. // require.Equal(t, tt.tree, urn.Tree(), herror(ii, tt)) // (fixme) > flatten tree?
  14. // Ignoring column testing since there is no error
  15. } else {
  16. require.False(t, tt.ok, herror(ii, tt))
  17. require.Equal(t, tt.col, err.(*Error).Column, herror(ii, tt))
  18. require.Empty(t, urn, herror(ii, tt))
  19. // require.Empty(t, urn.Tree(), herror(ii, tt))
  20. }
  21. }
  22. }