Skip to content

Commit

Permalink
Fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vadlakondaswetha committed Oct 16, 2024
1 parent aab8ad1 commit 8468693
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
14 changes: 14 additions & 0 deletions internal/block/block.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package block

import (
Expand Down
21 changes: 18 additions & 3 deletions internal/block/block_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package block

import (
"fmt"
"io"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
)

const outOfCapacityError string = "received data more than capacity of the block"

type MemoryBlockTest struct {
suite.Suite
}
Expand Down Expand Up @@ -44,7 +59,7 @@ func (testSuite *MemoryBlockTest) TestMemoryBlockWriteWithDataGreaterThanCapacit
err := mb.Write(content)

assert.NotNil(testSuite.T(), err)
assert.EqualError(testSuite.T(), err, fmt.Sprintf("received data more than capacity of the block"))
assert.EqualError(testSuite.T(), err, outOfCapacityError)
}

func (testSuite *MemoryBlockTest) TestMemoryBlockWriteWithMultipleWrites() {
Expand All @@ -68,7 +83,7 @@ func (testSuite *MemoryBlockTest) TestMemoryBlockWriteWith2ndWriteBeyondCapacity
err = mb.Write(content)

assert.NotNil(testSuite.T(), err)
assert.EqualError(testSuite.T(), err, fmt.Sprintf("received data more than capacity of the block"))
assert.EqualError(testSuite.T(), err, outOfCapacityError)
}

func (testSuite *MemoryBlockTest) TestMemoryBlockReuse() {
Expand Down

0 comments on commit 8468693

Please sign in to comment.