Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
180780c0
Unverified
Commit
180780c0
authored
4 years ago
by
Cam Saul
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused occurances-of-substring fn (#12979)
parent
1d0dafad
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/util.clj
+0
-9
0 additions, 9 deletions
src/metabase/util.clj
test/metabase/util_test.clj
+0
-19
0 additions, 19 deletions
test/metabase/util_test.clj
with
0 additions
and
28 deletions
src/metabase/util.clj
+
0
−
9
View file @
180780c0
...
...
@@ -554,15 +554,6 @@
"Increment `n` if it is non-`nil`, otherwise return `1` (e.g. as if incrementing `0`)."
(
fnil
inc
0
))
(
defn
occurances-of-substring
"Return the number of times SUBSTR occurs in string S."
^
Long
[
^
String
s,
^
String
substr
]
(
when
(
and
(
seq
s
)
(
seq
substr
))
(
loop
[
index
0
,
cnt
0
]
(
if-let
[
^
long
new-index
(
str/index-of
s
substr
index
)]
(
recur
(
inc
new-index
)
(
inc
cnt
))
cnt
))))
(
defn
select-non-nil-keys
"Like `select-keys`, but returns a map only containing keys in KS that are present *and non-nil* in M.
...
...
This diff is collapsed.
Click to expand it.
test/metabase/util_test.clj
+
0
−
19
View file @
180780c0
...
...
@@ -151,25 +151,6 @@
"<<>>"
false
"{\"a\": 10}"
false
))
(
deftest
occurances-of-substring-test
(
testing
"should return nil if one or both strings are nil or empty"
(
are+
[
s
substr
expected
]
(
=
expected
(
u/occurances-of-substring
s
substr
))
nil
nil
nil
nil
""
nil
""
nil
nil
""
""
nil
"ABC"
""
nil
""
" ABC"
nil
;; non-empty strings
"ABC"
"A"
1
"ABA"
"A"
2
"AAA"
"A"
3
"ABC"
"{{id}}"
0
"WHERE ID = {{id}}"
"{{id}}"
1
"WHERE ID = {{id}} OR USER_ID = {{id}}"
"{{id}}"
2
"WHERE ID = {{id}} OR USER_ID = {{id}} OR TOUCAN_ID = {{id}} OR BIRD_ID = {{bird}}"
"{{id}}"
3
)))
(
deftest
select-keys-test
(
testing
"select-non-nil-keys"
(
is
(
=
{
:a
100
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment