Skip to content

Commit

Permalink
Merge branch 'master' into prepare-for-v0.24.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnavarro authored Jul 9, 2019
2 parents df8d11e + 9bbaa1a commit c546711
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/function/commit_file_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (f *CommitFileStats) WithChildren(children ...sql.Expression) (sql.Expressi
to = children[1]
}

return &CommitStats{repo, from, to}, nil
return &CommitFileStats{repo, from, to}, nil
}

// Children implements the Expression interface.
Expand Down
16 changes: 16 additions & 0 deletions internal/function/commit_file_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package function

import (
"context"

"reflect"
"testing"

"github.com/src-d/gitbase"
Expand Down Expand Up @@ -80,3 +82,17 @@ func TestCommitFileStats(t *testing.T) {
})
}
}

func TestWithChildren(t *testing.T) {
repo := expression.NewGetField(0, sql.Text, "repository_id", false)
from := expression.NewGetField(2, sql.Text, "commit_hash", false)

cfs, err := NewCommitFileStats(repo, from)
require.NoError(t, err)

newCfs, err := cfs.WithChildren(repo, from)

require.NoError(t, err)
require.EqualValues(t, cfs.Children(), newCfs.Children())
require.Equal(t, reflect.TypeOf(cfs), reflect.TypeOf(newCfs))
}

0 comments on commit c546711

Please sign in to comment.