Build artifacts are now cleaned up on Windows too.
Tests should be a lot less noisy now. Fixed a bug where BulkGetMap didn't return any users if you opted out of using a memory cache for the user store. Used new() in a few more places. Fixed a test which didn't work properly. Tweaked the panel_pages_no_pages phrase.
This commit is contained in:
parent
7e935b6df0
commit
2d7f302768
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
|
@ -12,8 +12,8 @@ func (mus *NullUserCache) Get(id int) (*User, error) {
|
|||
return nil, ErrNoRows
|
||||
}
|
||||
|
||||
func (mus *NullUserCache) BulkGet(ids []int) (list []*User) {
|
||||
return list
|
||||
func (mus *NullUserCache) BulkGet(_ []int) (list []*User) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (mus *NullUserCache) GetUnsafe(id int) (*User, error) {
|
||||
|
|
|
@ -380,7 +380,7 @@ func copyTopicToTopicUser(topic *Topic, user *User) (tu TopicUser) {
|
|||
|
||||
// For use in tests and for generating blank topics for forums which don't have a last poster
|
||||
func BlankTopic() *Topic {
|
||||
return &Topic{ID: 0, Title: ""}
|
||||
return new(Topic)
|
||||
}
|
||||
|
||||
func BuildTopicURL(slug string, tid int) string {
|
||||
|
|
|
@ -392,7 +392,7 @@ func wordsToScore(wcount int, topic bool) (score int) {
|
|||
|
||||
// For use in tests and to help generate dummy users for forums which don't have last posters
|
||||
func BlankUser() *User {
|
||||
return &User{ID: 0, Name: ""}
|
||||
return new(User)
|
||||
}
|
||||
|
||||
// TODO: Write unit tests for this
|
||||
|
|
|
@ -129,6 +129,7 @@ func (mus *DefaultUserStore) BulkGetMap(ids []int) (list map[int]*User, err erro
|
|||
|
||||
var stillHere []int
|
||||
sliceList := mus.cache.BulkGet(ids)
|
||||
if len(sliceList) > 0 {
|
||||
for i, sliceItem := range sliceList {
|
||||
if sliceItem != nil {
|
||||
list[sliceItem.ID] = sliceItem
|
||||
|
@ -137,6 +138,7 @@ func (mus *DefaultUserStore) BulkGetMap(ids []int) (list map[int]*User, err erro
|
|||
}
|
||||
}
|
||||
ids = stillHere
|
||||
}
|
||||
|
||||
// If every user is in the cache, then return immediately
|
||||
if len(ids) == 0 {
|
||||
|
|
|
@ -45,7 +45,11 @@ func ResetTables() (err error) {
|
|||
}
|
||||
|
||||
func gloinit() (err error) {
|
||||
// TODO: Make these configurable via flags to the go test command
|
||||
common.Dev.DebugMode = false
|
||||
common.Dev.SuperDebug = false
|
||||
common.Dev.TemplateDebug = false
|
||||
qgen.LogPrepares = false
|
||||
//nogrouplog = true
|
||||
common.StartTime = time.Now()
|
||||
|
||||
|
|
|
@ -662,7 +662,7 @@
|
|||
"panel_pages_head":"Page Manager",
|
||||
"panel_pages_edit_button_aria":"Edit Page",
|
||||
"panel_pages_delete_button_aria":"Delete Page",
|
||||
"panel_pages_no_pages":"There aren't any pages.",
|
||||
"panel_pages_no_pages":"You don't have any pages yet.",
|
||||
"panel_pages_create_head":"Create Page",
|
||||
"panel_pages_create_name":"Name",
|
||||
"panel_pages_create_name_placeholder":"faq",
|
||||
|
|
|
@ -124,11 +124,7 @@ func userStoreTest(t *testing.T, newUserID int) {
|
|||
expect(t, isCacheLengthZero(ucache), fmt.Sprintf("User cache length should be 0, not %d", cacheLength(ucache)))
|
||||
|
||||
userList, _ = common.Users.BulkGetMap([]int{1})
|
||||
if len(userList) == 0 {
|
||||
t.Error("The returned map is empty for UID #1")
|
||||
} else if len(userList) > 1 {
|
||||
t.Error("Too many results were returned for UID #1")
|
||||
}
|
||||
expect(t, len(userList) == 1, fmt.Sprintf("Returned map should have one result (UID #1), not %d", len(userList)))
|
||||
|
||||
user, ok := userList[1]
|
||||
if !ok {
|
||||
|
@ -620,7 +616,7 @@ func TestForumStore(t *testing.T) {
|
|||
forum, err = common.Forums.Get(3)
|
||||
recordMustExist(t, err, "Couldn't find FID #3")
|
||||
|
||||
expect(t, forum.ID == 2, fmt.Sprintf("The FID should be 3 not %d", forum.ID))
|
||||
expect(t, forum.ID == 3, fmt.Sprintf("The FID should be 3 not %d", forum.ID))
|
||||
expect(t, forum.Name == "Test Forum", fmt.Sprintf("The name of the forum should be 'Test Forum' not '%s'", forum.Name))
|
||||
expect(t, forum.Active, fmt.Sprintf("The test forum should be active"))
|
||||
expect(t, forum.Desc == "", fmt.Sprintf("The forum description should be blank not '%s'", forum.Desc))
|
||||
|
|
|
@ -6,6 +6,8 @@ import (
|
|||
"log"
|
||||
)
|
||||
|
||||
var LogPrepares = true
|
||||
|
||||
type Accumulator struct {
|
||||
conn *sql.DB
|
||||
adapter Adapter
|
||||
|
@ -43,7 +45,9 @@ func (build *Accumulator) recordError(err error) {
|
|||
}
|
||||
|
||||
func (build *Accumulator) prepare(res string, err error) *sql.Stmt {
|
||||
if LogPrepares {
|
||||
log.Print("res: ", res)
|
||||
}
|
||||
if err != nil {
|
||||
build.recordError(err)
|
||||
return nil
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
6
run.bat
6
run.bat
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
@echo off
|
||||
rem TODO: Make these deletes a little less noisy
|
||||
del "template_*.go"
|
||||
del "gen_*.go"
|
||||
del "tmpl_client/template_*.go"
|
||||
del "gosora.exe"
|
||||
|
||||
echo Generating the dynamic code
|
||||
go generate
|
||||
if %errorlevel% neq 0 (
|
||||
|
|
Loading…
Reference in New Issue