Skip to content

Commit

Permalink
code clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
rokath committed Oct 16, 2024
1 parent 53c7080 commit 84fc136
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions internal/id/cachedClean_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func Test_0_1_0000X_clean_on_invalid_cCache_invalid_iCache_cleaned_file(t *testi

assert.Nil(t, args.Handler(W, FSys, []string{"trice", "clean", "-cache", "-til", FnJSON, "-li", LIFnJSON, "-src", SFName}))
assertFileContent(t, FSys, SFName, `trice("msg:value=%d\n", -1);`) // check file content
assertMTime(t, FSys, sT0, SFName) // check for untouched sFname
assertEqualMTimes(t, FSys, SFName, CCache) // check for correct updated cCache
assertFileNotExists(t, FSys, ICache) // check for not existing iCache
assertMTime(t, FSys, sT0, SFName) // check for untouched SFName
assertEqualMTimes(t, FSys, SFName, CCache) // check for correct updated CCache
assertFileNotExists(t, FSys, ICache) // check for not existing ICache
}

func Test_2_3_0001X_clean_on_inalid_cCache_invalid_iCache_inserted_X_file(t *testing.T) {
func Test_2_3_0001X_clean_on_invalid_cCache_invalid_iCache_inserted_X_file(t *testing.T) {
defer Setup(t)() // This executes Setup(t) and puts the returned function into the defer list.
assertFileCreate(t, FSys, SFName, `trice(iD(999), "msg:value=%d\n", -1);`) // inserted

Expand Down
5 changes: 1 addition & 4 deletions internal/id/range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package id_test

import (
"fmt"
"testing"

"github.com/rokath/trice/internal/args"
Expand Down Expand Up @@ -43,9 +42,7 @@ func TestRange1(t *testing.T) {
assert.Nil(t, FSys.WriteFile(sFn, []byte(src), 0777))

// action
assert.Nil(t, args.Handler(W, FSys, []string{"trice", "insert", "-IDRange", "e:100,109", "-IDRange", "dbg:200,209", "-IDMax=1005", "-IDMethod", "upward", "-src", sFn, "-til", FnJSON, "-li", LIFnJSON}))

fmt.Println(IDData.IDSpace)
assert.Nil(t, args.Handler(W, FSys, []string{"trice", "insert", "-IDRange", "e:100,102", "-IDRange", "dbg:200,203", "-IDMax=1005", "-IDMethod", "upward", "-src", sFn, "-til", FnJSON, "-li", LIFnJSON}))

// check modified src file
expSrc := `trice(iD(1000), "msg:Hi\n"); ... trice(iD(100), "err:Alarm!\n"); ... trice(iD(1001), "msg:Lo\n"); ... trice(iD(200), "d:foo\n");`
Expand Down

0 comments on commit 84fc136

Please sign in to comment.