Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
asapo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joao Alvim Oliveira Dias De Almeida
asapo
Commits
497f985e
Commit
497f985e
authored
3 years ago
by
Sergey Yakubov
Browse files
Options
Downloads
Patches
Plain Diff
add int test, start updating go logs
parent
8183e4fb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/cpp/unittests/json_parser/test_json_parser.cpp
+13
-0
13 additions, 0 deletions
common/cpp/unittests/json_parser/test_json_parser.cpp
common/go/src/asapo_common/logger/logrus_test.go
+26
-0
26 additions, 0 deletions
common/go/src/asapo_common/logger/logrus_test.go
with
39 additions
and
0 deletions
common/cpp/unittests/json_parser/test_json_parser.cpp
+
13
−
0
View file @
497f985e
...
...
@@ -281,4 +281,17 @@ TEST_F(ParseFileTests, Flatten) {
}
TEST
(
ParseString
,
RawString
)
{
std
::
string
json
=
R"({"top":"top","embedded":{"ar":[2,2,3],"str":"text"}})"
;
std
::
string
json_row
=
R"({"ar":[2,2,3],"str":"text"})"
;
JsonStringParser
parser
{
json
};
std
::
string
res
;
auto
err
=
parser
.
Embedded
(
"embedded"
).
GetRawString
(
&
res
);
ASSERT_THAT
(
err
,
Eq
(
nullptr
));
ASSERT_THAT
(
res
,
Eq
(
json_row
));
}
}
This diff is collapsed.
Click to expand it.
common/go/src/asapo_common/logger/logrus_test.go
0 → 100644
+
26
−
0
View file @
497f985e
package
logger
import
(
"fmt"
"github.com/sirupsen/logrus/hooks/test"
"github.com/stretchr/testify/assert"
"testing"
)
func
logStr
(
hook
*
test
.
Hook
)
string
{
s
:=
""
for
_
,
entry
:=
range
hook
.
AllEntries
()
{
ss
,
_
:=
entry
.
String
()
s
+=
ss
}
return
s
}
func
TestLog
(
t
*
testing
.
T
)
{
l
:=
&
logRusLogger
{}
hook
:=
test
.
NewLocal
(
l
.
entry
()
.
Logger
)
l
.
WithFields
(
map
[
string
]
interface
{}{
"testmap"
:
1
})
.
Info
(
"aaa"
)
fmt
.
Println
(
logStr
(
hook
))
assert
.
Contains
(
t
,
logStr
(
hook
),
"testmap"
)
}
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