Debian Codegraph @

v2/sarif/address_test.go

raw
1 package sarif
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7 )
8
9 func Test_create_new_simple_address(t *testing.T) {
10
11 address := NewAddress().
12 WithIndex(1).
13 WithName("google").
14 WithFullyQualifiedName("https://www.google.com")
15
16 assert.Equal(t, `{"index":1,"name":"google","fullyQualifiedName":"https://www.google.com"}`, getJsonString(address))
17 }
18
19 func Test_create_new_absolute_address(t *testing.T) {
20
21 address := NewAddress().
22 WithIndex(1).
23 WithName("google").
24 WithAbsoluteAddress(1).
25 WithKind("url").
26 WithLength(10)
27
28 assert.Equal(t, `{"index":1,"absoluteAddress":1,"length":10,"name":"google","kind":"url"}`, getJsonString(address))
29 }