gitea source for verification 2026-05-22
This commit is contained in:
26
modules/regexplru/regexplru_test.go
Normal file
26
modules/regexplru/regexplru_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package regexplru
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRegexpLru(t *testing.T) {
|
||||
r, err := GetCompiled("a")
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, r.MatchString("a"))
|
||||
|
||||
r, err = GetCompiled("a")
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, r.MatchString("a"))
|
||||
|
||||
assert.Equal(t, 1, lruCache.Len())
|
||||
|
||||
_, err = GetCompiled("(")
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, 2, lruCache.Len())
|
||||
}
|
||||
Reference in New Issue
Block a user