github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/cxx_record_decl_test.go (about)

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestCXXRecordDecl(t *testing.T) {
     8  	nodes := map[string]Node{
     9  		`0x2c6c2d0 <col:1, col:7> col:7 implicit class person`: &CXXRecordDecl{
    10  			RecordDecl: &RecordDecl{
    11  				Addr:         0x2c6c2d0,
    12  				Pos:          NewPositionFromString("col:1, col:7"),
    13  				Prev:         "",
    14  				Position2:    "col:7",
    15  				Kind:         "class",
    16  				IsImplicit:   true,
    17  				Name:         "person",
    18  				IsDefinition: false,
    19  				ChildNodes:   []Node{},
    20  			}},
    21  		`0x2c6c2d0 <col:1, col:7> class person`: &CXXRecordDecl{
    22  			&RecordDecl{
    23  				Addr: 0x2c6c2d0,
    24  				Pos:  NewPositionFromString("col:1, col:7"),
    25  				// Prev: "",
    26  				// Position2:  "col:7",
    27  				Kind:         "class",
    28  				IsImplicit:   false,
    29  				Name:         "person",
    30  				IsDefinition: false,
    31  				ChildNodes:   []Node{},
    32  			}},
    33  		`0x23ac438 <line:9:1, line:16:1> line:9:7 referenced class Rectangle definition`: &CXXRecordDecl{
    34  			&RecordDecl{
    35  				Addr:         0x23ac438,
    36  				Pos:          NewPositionFromString("line:9:1, line:16:1"),
    37  				Prev:         "",
    38  				Position2:    "line:9:7",
    39  				IsReferenced: true,
    40  				Kind:         "class",
    41  				Name:         "Rectangle",
    42  				IsImplicit:   false,
    43  				IsDefinition: true,
    44  				ChildNodes:   []Node{},
    45  			}},
    46  		`0x23ac438 <line:9:1, line:16:1> line:9:7 class Rectangle definition`: &CXXRecordDecl{
    47  			&RecordDecl{
    48  				Addr:         0x23ac438,
    49  				Pos:          NewPositionFromString("line:9:1, line:16:1"),
    50  				Prev:         "",
    51  				Position2:    "line:9:7",
    52  				IsReferenced: false,
    53  				Kind:         "class",
    54  				Name:         "Rectangle",
    55  				IsImplicit:   false,
    56  				IsDefinition: true,
    57  				ChildNodes:   []Node{},
    58  			}},
    59  		`0x38f33c0 <col:1, col:7> col:7 implicit referenced class Circle`: &CXXRecordDecl{
    60  			&RecordDecl{
    61  				Addr:         0x38f33c0,
    62  				Pos:          NewPositionFromString("col:1, col:7"),
    63  				Prev:         "",
    64  				Position2:    "col:7",
    65  				IsImplicit:   true,
    66  				IsReferenced: true,
    67  				Kind:         "class",
    68  				Name:         "Circle",
    69  				IsDefinition: false,
    70  				ChildNodes:   []Node{},
    71  			}},
    72  	}
    73  
    74  	runNodeTests(t, nodes)
    75  }