Newer
Older
//@author Ajit Jagtap
//@version Thu Jul 05 2018 06:40:10 GMT+0530 (IST)
package loggermdl
import (
"encoding/json"
"fmt"
"testing"
"corelab.mkcl.org/MKCLOS/coredevelopmentplatform/corepkgv2/errormdl"
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"github.com/stretchr/testify/assert"
"go.uber.org/zap/zapcore"
)
func ExampleLogVars() {
type Example struct {
name string
}
a := Example{"name"}
LogVars(a)
//Output:
//(loggermdl.Example)(loggermdl.Example{
// name: (string)("name"),
//})
}
func ExampleLogError() {
LogError("a")
//Output:
//
}
func ExampleLogInfo() {
LogInfo("a")
//Output:
//
}
func ExampleLogWarn() {
LogWarn("a")
//Output:
//
}
func ExampleLogDebug() {
LogDebug("a")
//Output:
//
}
func TestLogJSONString(t *testing.T) {
a := `{"Age": 1,"Name": "sometext"}`
assert.NotPanics(t, func() { LogJSONString(a) }, "The code did panic")
//Output2:
// {
// "Age": 1,
// "Name": "sometext"
// }
}
func ExampleLogHREnd() {
LogHREnd()
//Output:
//<<<<<<<<<<<<<<<<<<<<<<<
}
func TestLogJSONObject(t *testing.T) {
type MySt struct {
Name string
Age int
}
m := MySt{"sometext", 1}
// jsonUnmarshal(json.Marshal(m), &m)
assert.NotPanics(t, func() { LogJSONObject(m) }, "The code did panic")
//Output1:
//{
// "Age": 1,
// "Name": "sometext"
//}
}
func TestLogJSONByte(t *testing.T) { // func ExampleLogJSONByte() {
type MySt struct {
Name string
Age int
}
m := MySt{"sometext", 1}
a, _ := json.Marshal(m)
assert.NotPanics(t, func() { LogJSONByte(a) }, "The code did panic")
//Output1:
// {
// "Age": 1,
// "Name": "sometext"
// }
}
func ExampleLogHRStart() {
LogHRStart()
//Output:
//>>>>>>>>>>>>>>>>>>>>>>>
}
func ExampleGetCaller() {
errormdl.IsTestingNegetiveCaseOnCheckBool = false
a := GetCallers(0)
fmt.Println(len(a))
//output:
//15
}
func ExampleNegetiveGetCaller() {
a := GetCallers(-323232323)
fmt.Println(len(a))
//output:
//8
}
func ExampleInit() {
Init("filename", 3, 7, 5, zapcore.DebugLevel)
//output:
//
}
func TestLogPanic(t *testing.T) {
assert.Panics(t, func() { LogPanic("a") }, "The code did not panic")
assert.NotPanics(t, func() { LogSpot("A") }, "The code did not panic")
// func TestLogTable(t *testing.T) {
// type MySt struct {
// Name string
// Age int
// }
// m1 := MySt{"sometextm1", 1}
// m2 := MySt{"sometext m2", 13}
// ary := make([]interface{}, 2)
// ary = append(ary, m1)
// ary = append(ary, m2)
// assert.NotPanics(t, func() { LogTable(ary) }, "The code did panic")
// }