Improve test coverage.
This commit is contained in:
		
							parent
							
								
									d8552bcf9d
								
							
						
					
					
						commit
						a251e7382e
					
				|  | @ -5,20 +5,30 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAlignedAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f8a1d8ccfd0 <col:47, col:57> aligned`: &AlignedAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f8a1d8ccfd0 <col:47, col:57> aligned`: | ||||
| 		testNode{&AlignedAttr{ | ||||
| 			Addr:       0x7f8a1d8ccfd0, | ||||
| 			Pos:        NewPositionFromString("col:47, col:57"), | ||||
| 			IsAligned:  true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 			}, | ||||
| 			0x7f8a1d8ccfd0, | ||||
| 			NewPositionFromString("col:47, col:57"), | ||||
| 			[]Node{}, | ||||
| 		}, | ||||
| 		`0x2c8ba10 <col:42>`: &AlignedAttr{ | ||||
| 		`0x2c8ba10 <col:42>`: testNode{ &AlignedAttr{ | ||||
| 			Addr:       0x2c8ba10, | ||||
| 			Pos:        NewPositionFromString("col:42"), | ||||
| 			IsAligned:  false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 			}, | ||||
| 			0x2c8ba10, | ||||
| 			NewPositionFromString("col:42"), | ||||
| 			[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,22 +5,45 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAllocSizeAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f8e390a5d38 <col:100, col:114> 1 2`: &AllocSizeAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f8e390a5d38 <col:100, col:114> 1 2`: | ||||
| 		testNode{&AllocSizeAttr{ | ||||
| 			Addr:       0x7f8e390a5d38, | ||||
| 			Pos:        NewPositionFromString("col:100, col:114"), | ||||
| 			A:          1, | ||||
| 			B:          2, | ||||
| 			A:          "1", | ||||
| 			B:          "2", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1 0`: &AllocSizeAttr{ | ||||
| 		0x7f8e390a5d38, | ||||
| 		NewPositionFromString("col:100, col:114"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1 0`: | ||||
| 		testNode{&AllocSizeAttr{ | ||||
| 			Addr:       0x7fbd1a167f48, | ||||
| 			Pos:        NewPositionFromString("/usr/include/stdlib.h:342:37"), | ||||
| 			Inherited:  true, | ||||
| 			A:          1, | ||||
| 			B:          0, | ||||
| 			A:          "1", | ||||
| 			B:          "0", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fbd1a167f48, | ||||
| 		NewPositionFromString("/usr/include/stdlib.h:342:37"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fbd1a167f48 </usr/include/stdlib.h:342:37> Inherited 1`: | ||||
| 		testNode{&AllocSizeAttr{ | ||||
| 			Addr:       0x7fbd1a167f48, | ||||
| 			Pos:        NewPositionFromString("/usr/include/stdlib.h:342:37"), | ||||
| 			Inherited:  true, | ||||
| 			A:          "1", | ||||
| 			B:          "", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fbd1a167f48, | ||||
| 		NewPositionFromString("/usr/include/stdlib.h:342:37"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAlwaysInlineAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fce780f5018 </usr/include/sys/cdefs.h:313:68> always_inline`: &AlwaysInlineAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fce780f5018 </usr/include/sys/cdefs.h:313:68> always_inline`: | ||||
| 		testNode{&AlwaysInlineAttr{ | ||||
| 			Addr:       0x7fce780f5018, | ||||
| 			Pos:        NewPositionFromString("/usr/include/sys/cdefs.h:313:68"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fce780f5018, | ||||
| 		NewPositionFromString("/usr/include/sys/cdefs.h:313:68"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										22
									
								
								ast/arc_weakref_unavailable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/arc_weakref_unavailable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestArcWeakrefUnavailableAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&ArcWeakrefUnavailableAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -1,20 +1,13 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"reflect" | ||||
| 	"testing" | ||||
| 
 | ||||
| 	"git.wow.st/gmp/nswrap/util" | ||||
| ) | ||||
| 
 | ||||
| func TestArrayFiller(t *testing.T) { | ||||
| 	expected := &ArrayFiller{ | ||||
| 		ChildNodes: []Node{}, | ||||
| 	} | ||||
| 	actual := Parse(`array filler`) | ||||
| 
 | ||||
| 	if !reflect.DeepEqual(expected, actual) { | ||||
| 		t.Errorf("%s", util.ShowDiff(formatMultiLine(expected), | ||||
| 			formatMultiLine(actual))) | ||||
| 	} | ||||
| 	i := 0 | ||||
| 	runNodeTest(t, Parse(`array filler`), | ||||
| 		testNode{ &ArrayFiller{ ChildNodes: []Node{} }, | ||||
| 		0,NewPositionFromString(""),[]Node{}}, | ||||
| 		&i) | ||||
| } | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestArraySubscriptExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fe35b85d180 <col:63, col:69> 'char *' lvalue`: &ArraySubscriptExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fe35b85d180 <col:63, col:69> 'char *' lvalue`: | ||||
| 		testNode{&ArraySubscriptExpr{ | ||||
| 			Addr:       0x7fe35b85d180, | ||||
| 			Pos:        NewPositionFromString("col:63, col:69"), | ||||
| 			Type:       "char *", | ||||
|  | @ -14,7 +15,12 @@ func TestArraySubscriptExpr(t *testing.T) { | |||
| 			IsLvalue:   true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x2416660 <col:2, col:5> 'u32':'unsigned int' lvalue`: &ArraySubscriptExpr{ | ||||
| 		0x7fe35b85d180, | ||||
| 		NewPositionFromString("col:63, col:69"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x2416660 <col:2, col:5> 'u32':'unsigned int' lvalue`: | ||||
| 		testNode{&ArraySubscriptExpr{ | ||||
| 			Addr:       0x2416660, | ||||
| 			Pos:        NewPositionFromString("col:2, col:5"), | ||||
| 			Type:       "u32", | ||||
|  | @ -22,7 +28,12 @@ func TestArraySubscriptExpr(t *testing.T) { | |||
| 			IsLvalue:   true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x3f147c0 <col:39, col:55> 'extCoord':'extCoord' lvalue`: &ArraySubscriptExpr{ | ||||
| 		0x2416660, | ||||
| 		NewPositionFromString("col:2, col:5"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x3f147c0 <col:39, col:55> 'extCoord':'extCoord' lvalue`: | ||||
| 		testNode{&ArraySubscriptExpr{ | ||||
| 			Addr:       0x3f147c0, | ||||
| 			Pos:        NewPositionFromString("col:39, col:55"), | ||||
| 			Type:       "extCoord", | ||||
|  | @ -30,6 +41,10 @@ func TestArraySubscriptExpr(t *testing.T) { | |||
| 			IsLvalue:   true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x3f147c0, | ||||
| 		NewPositionFromString("col:39, col:55"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,21 +5,31 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAsmLabelAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7ff26d8224e8 </usr/include/sys/cdefs.h:569:36> "_fopen"`: &AsmLabelAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7ff26d8224e8 </usr/include/sys/cdefs.h:569:36> "_fopen"`: | ||||
| 		testNode{&AsmLabelAttr{ | ||||
| 			Addr:         0x7ff26d8224e8, | ||||
| 			Pos:          NewPositionFromString("/usr/include/sys/cdefs.h:569:36"), | ||||
| 			Inherited:    false, | ||||
| 			FunctionName: "_fopen", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fd55a169318 </usr/include/stdio.h:325:47> Inherited "_popen"`: &AsmLabelAttr{ | ||||
| 		0x7ff26d8224e8, | ||||
| 		NewPositionFromString("/usr/include/sys/cdefs.h:569:36"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fd55a169318 </usr/include/stdio.h:325:47> Inherited "_popen"`: | ||||
| 		testNode{&AsmLabelAttr{ | ||||
| 			Addr:         0x7fd55a169318, | ||||
| 			Pos:          NewPositionFromString("/usr/include/stdio.h:325:47"), | ||||
| 			Inherited:    true, | ||||
| 			FunctionName: "_popen", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x7fd55a169318, | ||||
| 		NewPositionFromString("/usr/include/stdio.h:325:47"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -9,7 +9,10 @@ import ( | |||
| 	"git.wow.st/gmp/nswrap/util" | ||||
| ) | ||||
| 
 | ||||
| var TrackPositions bool = false | ||||
| var ( | ||||
| 	TrackPositions bool = false | ||||
| 	Debug = false | ||||
| ) | ||||
| 
 | ||||
| // Node represents any node in the AST.
 | ||||
| type Node interface { | ||||
|  | @ -406,7 +409,9 @@ func groupsFromRegex(rx, line string) map[string]string { | |||
| 	re := util.GetRegex(rx) | ||||
| 	match := re.FindStringSubmatch(line) | ||||
| 	if len(match) == 0 { | ||||
| 		fmt.Printf("AST parser: could not match regexp with string. Regexp:\n" + rx + "\nOriginal line:\n" + line + "\n\n") | ||||
| 		if Debug { | ||||
| 			fmt.Printf("AST parser: could not match regexp with string. Regexp:\n" + rx + "\nOriginal line:\n" + line + "\n\n") | ||||
| 		} | ||||
| 		return nil | ||||
| 	} | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,13 @@ import ( | |||
| 	"git.wow.st/gmp/nswrap/util" | ||||
| ) | ||||
| 
 | ||||
| type testNode struct { | ||||
| 	n Node | ||||
| 	addr Address | ||||
| 	pos Position | ||||
| 	children []Node | ||||
| } | ||||
| 
 | ||||
| func init() { | ||||
| 	TrackPositions = true | ||||
| } | ||||
|  | @ -21,26 +28,50 @@ func formatMultiLine(o interface{}) string { | |||
| 	return s | ||||
| } | ||||
| 
 | ||||
| func runNodeTest(t *testing.T, actual, expected Node, i int) { | ||||
| 	testName := fmt.Sprintf("Example%d", i) | ||||
| 	t.Run(testName, func(t *testing.T) { | ||||
| 		if !reflect.DeepEqual(expected, actual) { | ||||
| 			t.Errorf("%s", util.ShowDiff(formatMultiLine(expected), | ||||
| func runNodeTest(t *testing.T, actual Node, expected testNode, i *int) { | ||||
| 	testName := fmt.Sprintf("Example%d", *i) | ||||
| 	t.Run(testName + "a", func(t *testing.T) { | ||||
| 		if !reflect.DeepEqual(expected.n, actual) { | ||||
| 			t.Errorf("%s", util.ShowDiff(formatMultiLine(expected.n), | ||||
| 				formatMultiLine(actual))) | ||||
| 		} | ||||
| 	}) | ||||
| 	t.Run(testName+"b", func(t *testing.T) { | ||||
| 		if !reflect.DeepEqual(actual.Address(),expected.addr) { | ||||
| 			t.Errorf("Address mismatch") | ||||
| 		} | ||||
| 	}) | ||||
| 	t.Run(testName+"c", func(t *testing.T) { | ||||
| 		if !reflect.DeepEqual(actual.Position(),expected.pos) { | ||||
| 			t.Errorf("Position mismatch") | ||||
| 		} | ||||
| 	}) | ||||
| 	t.Run(testName+"d", func(t *testing.T) { | ||||
| 		if !reflect.DeepEqual(actual.Children(),expected.children) { | ||||
| 			t.Errorf("Children mismatch") | ||||
| 		} | ||||
| 	}) | ||||
| 	t.Run(testName+"e", func(t *testing.T) { | ||||
| 		cs := expected.children | ||||
| 		node := &Unknown{} | ||||
| 		actual.AddChild(node) | ||||
| 		cs = append(cs,node) | ||||
| 		if !reflect.DeepEqual(actual.Children(),cs) { | ||||
| 			t.Errorf("Children mismatch") | ||||
| 		} | ||||
| 	}) | ||||
| 	(*i)++ | ||||
| } | ||||
| 
 | ||||
| func runNodeTests(t *testing.T, tests map[string]Node) { | ||||
| func runNodeTests(t *testing.T, tests map[string]testNode) { | ||||
| 	i := 1 | ||||
| 	for line, expected := range tests { | ||||
| 		// Append the name of the struct onto the front. This would
 | ||||
| 		// make the complete line it would normally be parsing.
 | ||||
| 		name := reflect.TypeOf(expected).Elem().Name() | ||||
| 		name := reflect.TypeOf(expected.n).Elem().Name() | ||||
| 		actual := Parse(name + " " + line) | ||||
| 
 | ||||
| 		runNodeTest(t,actual,expected,i) | ||||
| 		i++ | ||||
| 		runNodeTest(t,actual,expected,&i) | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  | @ -75,3 +106,4 @@ func BenchmarkParse(b *testing.B) { | |||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,58 +5,85 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAttributedType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x10c0d6770 'CVDisplayLinkRef _Nonnull' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		 testNode{&AttributedType{ | ||||
| 			Addr:       0x10c0d6770, | ||||
| 			Type:       `CVDisplayLinkRef _Nonnull`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x10c0d6770, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x10c0d68b0 'const CVTimeStamp * _Nonnull' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x10c0d68b0, | ||||
| 			Type:       `const CVTimeStamp * _Nonnull`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x10c0d68b0, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x10c0d6ab0 'CVOptionFlags * _Nonnull' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x10c0d6ab0, | ||||
| 			Type:       `CVOptionFlags * _Nonnull`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x10c0d6ab0, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x10c0fc7d0 'CVPixelBufferRef _Nonnull' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x10c0fc7d0, | ||||
| 			Type:       `CVPixelBufferRef _Nonnull`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x10c0fc7d0, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7faa1906d680 'NSError * _Nullable' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x7faa1906d680, | ||||
| 			Type:       `NSError * _Nullable`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7faa1906d680, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7faa19085760 'id<NSSecureCoding> _Nullable' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x7faa19085760, | ||||
| 			Type:       `id<NSSecureCoding> _Nullable`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7faa19085760, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7faa19085840 'NSError * _Null_unspecified' sugar`: | ||||
| 		 &AttributedType{ | ||||
| 		testNode{&AttributedType{ | ||||
| 			Addr:       0x7faa19085840, | ||||
| 			Type:       `NSError * _Null_unspecified`, | ||||
| 			Sugar:      true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7faa19085840, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestAvailabilityAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc5ff8e5d18 </usr/include/AvailabilityInternal.h:21697:88, col:124> macos 10.10 0 0 "" ""`: &AvailabilityAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc5ff8e5d18 </usr/include/AvailabilityInternal.h:21697:88, col:124> macos 10.10 0 0 "" ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8e5d18, | ||||
| 			Pos:           NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"), | ||||
| 			OS:            "macos", | ||||
|  | @ -19,7 +20,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e60d0 </usr/include/Availability.h:215:81, col:115> watchos 3.0 0 0 "" ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8e5d18, | ||||
| 		NewPositionFromString("/usr/include/AvailabilityInternal.h:21697:88, col:124"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e60d0 </usr/include/Availability.h:215:81, col:115> watchos 3.0 0 0 "" ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8e60d0, | ||||
| 			Pos:           NewPositionFromString("/usr/include/Availability.h:215:81, col:115"), | ||||
| 			OS:            "watchos", | ||||
|  | @ -32,7 +38,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e6170 <col:81, col:115> tvos 10.0 0 0 "" ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8e60d0, | ||||
| 		NewPositionFromString("/usr/include/Availability.h:215:81, col:115"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e6170 <col:81, col:115> tvos 10.0 0 0 "" ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8e6170, | ||||
| 			Pos:           NewPositionFromString("col:81, col:115"), | ||||
| 			OS:            "tvos", | ||||
|  | @ -45,7 +56,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e61d8 <col:81, col:115> ios 10.0 0 0 "" ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8e6170, | ||||
| 		NewPositionFromString("col:81, col:115"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8e61d8 <col:81, col:115> ios 10.0 0 0 "" ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8e61d8, | ||||
| 			Pos:           NewPositionFromString("col:81, col:115"), | ||||
| 			OS:            "ios", | ||||
|  | @ -58,7 +74,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8f0e18 </usr/include/sys/cdefs.h:275:50, col:99> swift 0 0 0 Unavailable "Use snprintf instead." ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8e61d8, | ||||
| 		NewPositionFromString("col:81, col:115"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8f0e18 </usr/include/sys/cdefs.h:275:50, col:99> swift 0 0 0 Unavailable "Use snprintf instead." ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8f0e18, | ||||
| 			Pos:           NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"), | ||||
| 			OS:            "swift", | ||||
|  | @ -71,7 +92,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8f1988 <line:275:50, col:99> swift 0 0 0 Unavailable "Use mkstemp(3) instead." ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8f0e18, | ||||
| 		NewPositionFromString("/usr/include/sys/cdefs.h:275:50, col:99"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc5ff8f1988 <line:275:50, col:99> swift 0 0 0 Unavailable "Use mkstemp(3) instead." ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7fc5ff8f1988, | ||||
| 			Pos:           NewPositionFromString("line:275:50, col:99"), | ||||
| 			OS:            "swift", | ||||
|  | @ -84,7 +110,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x104035438 </usr/include/AvailabilityInternal.h:14571:88, col:124> macosx 10.10 0 0 ""`: &AvailabilityAttr{ | ||||
| 		0x7fc5ff8f1988, | ||||
| 		NewPositionFromString("line:275:50, col:99"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x104035438 </usr/include/AvailabilityInternal.h:14571:88, col:124> macosx 10.10 0 0 ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x104035438, | ||||
| 			Pos:           NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"), | ||||
| 			OS:            "macosx", | ||||
|  | @ -97,7 +128,12 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   false, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bd588b1a8 </usr/include/gethostuuid.h:39:65, col:100> Inherited macos 10.5 0 0 "" ""`: &AvailabilityAttr{ | ||||
| 		0x104035438, | ||||
| 		NewPositionFromString("/usr/include/AvailabilityInternal.h:14571:88, col:124"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bd588b1a8 </usr/include/gethostuuid.h:39:65, col:100> Inherited macos 10.5 0 0 "" ""`: | ||||
| 		testNode{&AvailabilityAttr{ | ||||
| 			Addr:          0x7f9bd588b1a8, | ||||
| 			Pos:           NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"), | ||||
| 			OS:            "macos", | ||||
|  | @ -110,6 +146,10 @@ func TestAvailabilityAttr(t *testing.T) { | |||
| 			IsInherited:   true, | ||||
| 			ChildNodes:    []Node{}, | ||||
| 		}, | ||||
| 		0x7f9bd588b1a8, | ||||
| 		NewPositionFromString("/usr/include/gethostuuid.h:39:65, col:100"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,15 +5,21 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestBinaryOperator(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fca2d8070e0 <col:11, col:23> 'unsigned char' '='`: &BinaryOperator{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fca2d8070e0 <col:11, col:23> 'unsigned char' '='`: | ||||
| 		testNode{&BinaryOperator{ | ||||
| 			Addr:       0x7fca2d8070e0, | ||||
| 			Pos:        NewPositionFromString("col:11, col:23"), | ||||
| 			Type:       "unsigned char", | ||||
| 			Operator:   "=", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x1ff95b8 <line:78:2, col:7> 'T_ENUM':'T_ENUM' '='`: &BinaryOperator{ | ||||
| 		0x7fca2d8070e0, | ||||
| 		NewPositionFromString("col:11, col:23"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x1ff95b8 <line:78:2, col:7> 'T_ENUM':'T_ENUM' '='`: | ||||
| 		testNode{&BinaryOperator{ | ||||
| 			Addr:       0x1ff95b8, | ||||
| 			Pos:        NewPositionFromString("line:78:2, col:7"), | ||||
| 			Type:       "T_ENUM", | ||||
|  | @ -21,6 +27,10 @@ func TestBinaryOperator(t *testing.T) { | |||
| 			Operator:   "=", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x1ff95b8, | ||||
| 		NewPositionFromString("line:78:2, col:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestBlockCommandComment(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x1069fae60 <col:4, line:163:57> Name="abstract"`: &BlockCommandComment{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x1069fae60 <col:4, line:163:57> Name="abstract"`: | ||||
| 		testNode{&BlockCommandComment{ | ||||
| 			Addr:       0x1069fae60, | ||||
| 			Pos:        NewPositionFromString("col:4, line:163:57"), | ||||
| 			Name:       "abstract", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x1069fae60, | ||||
| 		NewPositionFromString("col:4, line:163:57"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,19 +5,27 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestBlockPointerType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fa3b88bbb30 'void (^)(void)'`: | ||||
| 		&BlockPointerType{ | ||||
| 		testNode{&BlockPointerType{ | ||||
| 			Addr:       0x7fa3b88bbb30, | ||||
| 			Type:       `void (^)(void)`, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fa3b88bbb30, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fa3b88bbb30 'NSComparisonResult (^)(id _Nonnull, id _Nonnull)'`: | ||||
| 		&BlockPointerType{ | ||||
| 		testNode{&BlockPointerType{ | ||||
| 			Addr:       0x7fa3b88bbb30, | ||||
| 			Type:       `NSComparisonResult (^)(id _Nonnull, id _Nonnull)`, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fa3b88bbb30, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestBreakStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fca2d8070e0 <col:11, col:23>`: &BreakStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fca2d8070e0 <col:11, col:23>`: | ||||
| 		testNode{&BreakStmt{ | ||||
| 			Addr:       0x7fca2d8070e0, | ||||
| 			Pos:        NewPositionFromString("col:11, col:23"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fca2d8070e0, | ||||
| 		NewPositionFromString("col:11, col:23"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,17 +5,27 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestBuiltinType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f8a43023f40 '__int128'`: &BuiltinType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f8a43023f40 '__int128'`: | ||||
| 		testNode{&BuiltinType{ | ||||
| 			Addr:       0x7f8a43023f40, | ||||
| 			Type:       "__int128", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f8a43023ea0 'unsigned long long'`: &BuiltinType{ | ||||
| 		0x7f8a43023f40, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f8a43023ea0 'unsigned long long'`: | ||||
| 		testNode{&BuiltinType{ | ||||
| 			Addr:       0x7f8a43023ea0, | ||||
| 			Type:       "unsigned long long", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f8a43023ea0, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,15 +5,21 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCStyleCastExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fddc18fb2e0 <col:50, col:56> 'char' <IntegralCast>`: &CStyleCastExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fddc18fb2e0 <col:50, col:56> 'char' <IntegralCast>`: | ||||
| 		testNode{&CStyleCastExpr{ | ||||
| 			Addr:       0x7fddc18fb2e0, | ||||
| 			Pos:        NewPositionFromString("col:50, col:56"), | ||||
| 			Type:       "char", | ||||
| 			Kind:       "IntegralCast", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x2781518 <col:7, col:17> 'T_ENUM':'T_ENUM' <IntegralCast>`: &CStyleCastExpr{ | ||||
| 		0x7fddc18fb2e0, | ||||
| 		NewPositionFromString("col:50, col:56"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x2781518 <col:7, col:17> 'T_ENUM':'T_ENUM' <IntegralCast>`: | ||||
| 		testNode{&CStyleCastExpr{ | ||||
| 			Addr:       0x2781518, | ||||
| 			Pos:        NewPositionFromString("col:7, col:17"), | ||||
| 			Type:       "T_ENUM", | ||||
|  | @ -21,6 +27,10 @@ func TestCStyleCastExpr(t *testing.T) { | |||
| 			Kind:       "IntegralCast", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x2781518, | ||||
| 		NewPositionFromString("col:7, col:17"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,19 +5,29 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCallExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f9bf3033240 <col:11, col:25> 'int'`: &CallExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f9bf3033240 <col:11, col:25> 'int'`: | ||||
| 		testNode{&CallExpr{ | ||||
| 			Addr:       0x7f9bf3033240, | ||||
| 			Pos:        NewPositionFromString("col:11, col:25"), | ||||
| 			Type:       "int", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bf3035c20 <line:7:4, col:64> 'int'`: &CallExpr{ | ||||
| 		0x7f9bf3033240, | ||||
| 		NewPositionFromString("col:11, col:25"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bf3035c20 <line:7:4, col:64> 'int'`: | ||||
| 		testNode{&CallExpr{ | ||||
| 			Addr:       0x7f9bf3035c20, | ||||
| 			Pos:        NewPositionFromString("line:7:4, col:64"), | ||||
| 			Type:       "int", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f9bf3035c20, | ||||
| 		NewPositionFromString("line:7:4, col:64"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCaseStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc8b5094688 <line:11:5, line:12:21>`: &CaseStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc8b5094688 <line:11:5, line:12:21>`: | ||||
| 		testNode{&CaseStmt{ | ||||
| 			Addr:       0x7fc8b5094688, | ||||
| 			Pos:        NewPositionFromString("line:11:5, line:12:21"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc8b5094688, | ||||
| 		NewPositionFromString("line:11:5, line:12:21"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										23
									
								
								ast/cf_audited_transfer_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/cf_audited_transfer_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestCFAuditedTransferAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&CFAuditedTransferAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										23
									
								
								ast/cf_consumed_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/cf_consumed_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestCFConsumedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&CFConsumedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/cf_returns_not_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/cf_returns_not_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestCFReturnsNotRetainedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&CFReturnsNotRetainedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/cf_returns_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/cf_returns_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestCFReturnsRetainedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&CFReturnsRetainedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,14 +5,19 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCharacterLiteral(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f980b858308 <col:62> 'int' 10`: &CharacterLiteral{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f980b858308 <col:62> 'int' 10`: | ||||
| 		testNode{&CharacterLiteral{ | ||||
| 			Addr:       0x7f980b858308, | ||||
| 			Pos:        NewPositionFromString("col:62"), | ||||
| 			Type:       "int", | ||||
| 			Value:      10, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f980b858308, | ||||
| 		NewPositionFromString("col:62"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCompoundAssignOperator(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x2dc5758 <line:5:2, col:7> 'int' '+=' ComputeLHSTy='int' ComputeResultTy='int'`: &CompoundAssignOperator{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x2dc5758 <line:5:2, col:7> 'int' '+=' ComputeLHSTy='int' ComputeResultTy='int'`: | ||||
| 		testNode{&CompoundAssignOperator{ | ||||
| 			Addr:                  0x2dc5758, | ||||
| 			Pos:                   NewPositionFromString("line:5:2, col:7"), | ||||
| 			Type:                  "int", | ||||
|  | @ -15,6 +16,10 @@ func TestCompoundAssignOperator(t *testing.T) { | |||
| 			ComputationResultType: "int", | ||||
| 			ChildNodes:            []Node{}, | ||||
| 		}, | ||||
| 		0x2dc5758, | ||||
| 		NewPositionFromString("line:5:2, col:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,14 +5,19 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCompoundLiteralExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x5575acce81f0 <col:21, col:40> 'struct node':'struct node' lvalue`: &CompoundLiteralExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x5575acce81f0 <col:21, col:40> 'struct node':'struct node' lvalue`: | ||||
| 		testNode{&CompoundLiteralExpr{ | ||||
| 			Addr:       0x5575acce81f0, | ||||
| 			Pos:        NewPositionFromString("col:21, col:40"), | ||||
| 			Type1:      "struct node", | ||||
| 			Type2:      "struct node", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x5575acce81f0, | ||||
| 		NewPositionFromString("col:21, col:40"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,17 +5,27 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestCompoundStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fbd0f014f18 <col:54, line:358:1>`: &CompoundStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fbd0f014f18 <col:54, line:358:1>`: | ||||
| 		testNode{&CompoundStmt{ | ||||
| 			Addr:       0x7fbd0f014f18, | ||||
| 			Pos:        NewPositionFromString("col:54, line:358:1"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fbd0f8360b8 <line:4:1, line:13:1>`: &CompoundStmt{ | ||||
| 		0x7fbd0f014f18, | ||||
| 		NewPositionFromString("col:54, line:358:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fbd0f8360b8 <line:4:1, line:13:1>`: | ||||
| 		testNode{&CompoundStmt{ | ||||
| 			Addr:       0x7fbd0f8360b8, | ||||
| 			Pos:        NewPositionFromString("line:4:1, line:13:1"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fbd0f8360b8, | ||||
| 		NewPositionFromString("line:4:1, line:13:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestConditionalOperator(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc6ae0bc678 <col:6, col:89> 'void'`: &ConditionalOperator{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc6ae0bc678 <col:6, col:89> 'void'`: | ||||
| 		testNode{&ConditionalOperator{ | ||||
| 			Addr:       0x7fc6ae0bc678, | ||||
| 			Pos:        NewPositionFromString("col:6, col:89"), | ||||
| 			Type:       "void", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc6ae0bc678, | ||||
| 		NewPositionFromString("col:6, col:89"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -14,9 +14,6 @@ func parseConstAttr(line string) Node { | |||
| 		"<(?P<position>.*)>(?P<tags>.*)", | ||||
| 		line, | ||||
| 	) | ||||
| 	if groups == nil { | ||||
| 		return &Unknown{} | ||||
| 	} | ||||
| 
 | ||||
| 	return &ConstAttr{ | ||||
| 		Addr:       ParseAddress(groups["address"]), | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestConstAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fa3b88bbb38 <line:4:1, line:13:1>foo`: &ConstAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fa3b88bbb38 <line:4:1, line:13:1>foo`: | ||||
| 		testNode{&ConstAttr{ | ||||
| 			Addr:       0x7fa3b88bbb38, | ||||
| 			Pos:        NewPositionFromString("line:4:1, line:13:1"), | ||||
| 			Tags:       "foo", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fa3b88bbb38, | ||||
| 		NewPositionFromString("line:4:1, line:13:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,19 +5,29 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestConstantArrayType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f94ad016a40 'struct __va_list_tag [1]' 1 `: &ConstantArrayType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f94ad016a40 'struct __va_list_tag [1]' 1 `: | ||||
| 		testNode{&ConstantArrayType{ | ||||
| 			Addr:       0x7f94ad016a40, | ||||
| 			Type:       "struct __va_list_tag [1]", | ||||
| 			Size:       1, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f8c5f059d20 'char [37]' 37 `: &ConstantArrayType{ | ||||
| 		0x7f94ad016a40, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f8c5f059d20 'char [37]' 37 `: | ||||
| 		testNode{&ConstantArrayType{ | ||||
| 			Addr:       0x7f8c5f059d20, | ||||
| 			Type:       "char [37]", | ||||
| 			Size:       37, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f8c5f059d20, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestContinueStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x1e044e0 <col:20>`: &ContinueStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x1e044e0 <col:20>`: | ||||
| 		testNode{&ContinueStmt{ | ||||
| 			Addr:       0x1e044e0, | ||||
| 			Pos:        NewPositionFromString("col:20"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x1e044e0, | ||||
| 		NewPositionFromString("col:20"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										36
									
								
								ast/convert_vector_expr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								ast/convert_vector_expr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,36 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestConvertVectorExpr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fdef0862430 <line:120:1, col:16>`: | ||||
| 		testNode{&ConvertVectorExpr{ | ||||
| 			Addr:         0x7fdef0862430, | ||||
| 			Pos:          NewPositionFromString("line:120:1, col:16"), | ||||
| 			Type:         "", | ||||
| 			Type2:        "", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x7fdef0862430, | ||||
| 		NewPositionFromString("line:120:1, col:16"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x113368318 <line:1354:20, line:1355:70> '__v2df':'__attribute__((__vector_size__(2 * sizeof(double)))) double'`: | ||||
| 		testNode{&ConvertVectorExpr{ | ||||
| 			Addr:         0x113368318, | ||||
| 			Pos:          NewPositionFromString("line:1354:20, line:1355:70"), | ||||
| 			Type:         `__v2df`, | ||||
| 			Type2:        `:'__attribute__((__vector_size__(2 * sizeof(double)))) double'`, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x113368318, | ||||
| 		NewPositionFromString("line:1354:20, line:1355:70"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDecayedType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f1234567890 'struct __va_list_tag *' sugar`: &DecayedType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f1234567890 'struct __va_list_tag *' sugar`: | ||||
| 		testNode{&DecayedType{ | ||||
| 			Addr:       0x7f1234567890, | ||||
| 			Type:       "struct __va_list_tag *", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f1234567890, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDeclRefExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`: &DeclRefExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`: | ||||
| 		testNode{&DeclRefExpr{ | ||||
| 			Addr:       0x7fc972064460, | ||||
| 			Pos:        NewPositionFromString("col:8"), | ||||
| 			Type:       "FILE *", | ||||
|  | @ -19,7 +20,12 @@ func TestDeclRefExpr(t *testing.T) { | |||
| 			Type3:      "", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`: &DeclRefExpr{ | ||||
| 		0x7fc972064460, | ||||
| 		NewPositionFromString("col:8"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`: | ||||
| 		testNode{&DeclRefExpr{ | ||||
| 			Addr:       0x7fc97206a958, | ||||
| 			Pos:        NewPositionFromString("col:11"), | ||||
| 			Type:       "int (int, FILE *)", | ||||
|  | @ -32,7 +38,12 @@ func TestDeclRefExpr(t *testing.T) { | |||
| 			Type3:      "", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`: &DeclRefExpr{ | ||||
| 		0x7fc97206a958, | ||||
| 		NewPositionFromString("col:11"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`: | ||||
| 		testNode{&DeclRefExpr{ | ||||
| 			Addr:       0x7fa36680f170, | ||||
| 			Pos:        NewPositionFromString("col:19"), | ||||
| 			Type:       "struct programming", | ||||
|  | @ -45,7 +56,12 @@ func TestDeclRefExpr(t *testing.T) { | |||
| 			Type3:      "struct programming", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`: &DeclRefExpr{ | ||||
| 		0x7fa36680f170, | ||||
| 		NewPositionFromString("col:19"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`: | ||||
| 		testNode{&DeclRefExpr{ | ||||
| 			Addr:       0x35cb438, | ||||
| 			Pos:        NewPositionFromString("col:13"), | ||||
| 			Type:       "int", | ||||
|  | @ -58,7 +74,12 @@ func TestDeclRefExpr(t *testing.T) { | |||
| 			Type3:      "", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`: &DeclRefExpr{ | ||||
| 		0x35cb438, | ||||
| 		NewPositionFromString("col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`: | ||||
| 		testNode{&DeclRefExpr{ | ||||
| 			Addr:       0x1ff8770, | ||||
| 			Pos:        NewPositionFromString("col:33"), | ||||
| 			Type:       "T_ENUM", | ||||
|  | @ -71,6 +92,10 @@ func TestDeclRefExpr(t *testing.T) { | |||
| 			Type3:      "T_ENUM", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x1ff8770, | ||||
| 		NewPositionFromString("col:33"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDeclStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fb791846e80 <line:11:4, col:31>`: &DeclStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fb791846e80 <line:11:4, col:31>`: | ||||
| 		testNode{&DeclStmt{ | ||||
| 			Addr:       0x7fb791846e80, | ||||
| 			Pos:        NewPositionFromString("line:11:4, col:31"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fb791846e80, | ||||
| 		NewPositionFromString("line:11:4, col:31"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDefaultStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f951308bfb0 <line:17:5, line:18:34>`: &DefaultStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f951308bfb0 <line:17:5, line:18:34>`: | ||||
| 		testNode{&DefaultStmt{ | ||||
| 			Addr:       0x7f951308bfb0, | ||||
| 			Pos:        NewPositionFromString("line:17:5, line:18:34"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f951308bfb0, | ||||
| 		NewPositionFromString("line:17:5, line:18:34"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDeprecatedAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fec4b0ab9c0 <line:180:48, col:63> "This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead." ""`: &DeprecatedAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fec4b0ab9c0 <line:180:48, col:63> "This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead." ""`: | ||||
| 		testNode{&DeprecatedAttr{ | ||||
| 			Addr:        0x7fec4b0ab9c0, | ||||
| 			Pos:         NewPositionFromString("line:180:48, col:63"), | ||||
| 			Message1:    "This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of tempnam(3), it is highly recommended that you use mkstemp(3) instead.", | ||||
|  | @ -14,7 +15,12 @@ func TestDeprecatedAttr(t *testing.T) { | |||
| 			IsInherited: false, | ||||
| 			ChildNodes:  []Node{}, | ||||
| 		}, | ||||
| 		`0xb75d00 <line:1107:12> "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: &DeprecatedAttr{ | ||||
| 		0x7fec4b0ab9c0, | ||||
| 		NewPositionFromString("line:180:48, col:63"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0xb75d00 <line:1107:12> "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: | ||||
| 		testNode{&DeprecatedAttr{ | ||||
| 			Addr:        0xb75d00, | ||||
| 			Pos:         NewPositionFromString("line:1107:12"), | ||||
| 			Message1:    "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.", | ||||
|  | @ -22,7 +28,12 @@ func TestDeprecatedAttr(t *testing.T) { | |||
| 			IsInherited: false, | ||||
| 			ChildNodes:  []Node{}, | ||||
| 		}, | ||||
| 		`0xb75d00 <line:1107:12> Inherited "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: &DeprecatedAttr{ | ||||
| 		0xb75d00, | ||||
| 		NewPositionFromString("line:1107:12"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0xb75d00 <line:1107:12> Inherited "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details." ""`: | ||||
| 		testNode{&DeprecatedAttr{ | ||||
| 			Addr:        0xb75d00, | ||||
| 			Pos:         NewPositionFromString("line:1107:12"), | ||||
| 			Message1:    "This function or variable may be unsafe. Consider using _snwprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.", | ||||
|  | @ -30,6 +41,10 @@ func TestDeprecatedAttr(t *testing.T) { | |||
| 			IsInherited: true, | ||||
| 			ChildNodes:  []Node{}, | ||||
| 		}, | ||||
| 		0xb75d00, | ||||
| 		NewPositionFromString("line:1107:12"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDisableTailCallsAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc8fa094558 <col:107> `: &DisableTailCallsAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc8fa094558 <col:107> `: | ||||
| 		testNode{&DisableTailCallsAttr{ | ||||
| 			Addr:       0x7fc8fa094558, | ||||
| 			Pos:        NewPositionFromString("col:107"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc8fa094558, | ||||
| 		NewPositionFromString("col:107"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestDoStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7ff36d0a0938 <line:11:5, line:14:23>`: &DoStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7ff36d0a0938 <line:11:5, line:14:23>`: | ||||
| 		testNode{&DoStmt{ | ||||
| 			Addr:       0x7ff36d0a0938, | ||||
| 			Pos:        NewPositionFromString("line:11:5, line:14:23"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7ff36d0a0938, | ||||
| 		NewPositionFromString("line:11:5, line:14:23"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestElaboratedType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f873686c120 'union __mbstate_t' sugar`: &ElaboratedType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f873686c120 'union __mbstate_t' sugar`: | ||||
| 		testNode{&ElaboratedType{ | ||||
| 			Addr:       0x7f873686c120, | ||||
| 			Type:       "union __mbstate_t", | ||||
| 			Tags:       "sugar", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f873686c120, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ type EmptyDecl struct { | |||
| func parseEmptyDecl(line string) Node { | ||||
| 	groups := groupsFromRegex( | ||||
| 		`<(?P<position>.*)> | ||||
| 		( (?P<position2>.*))?`, | ||||
| 		( (?P<position2>[^\s]+))?`, | ||||
| 		line, | ||||
| 	) | ||||
| 	if groups == nil { | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestEmptyDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x480bec8 <col:13> col:13`: &EmptyDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x480bec8 <col:13> col:13`: | ||||
| 		testNode{&EmptyDecl{ | ||||
| 			Addr:       0x480bec8, | ||||
| 			Pos:        NewPositionFromString("col:13"), | ||||
| 			Position2:  NewPositionFromString("col:13"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x480bec8, | ||||
| 		NewPositionFromString("col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestEnumConstantDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x1660db0 <line:185:3> __codecvt_noconv 'int'`: &EnumConstantDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x1660db0 <line:185:3> __codecvt_noconv 'int'`: | ||||
| 		testNode{&EnumConstantDecl{ | ||||
| 			Addr:       0x1660db0, | ||||
| 			Pos:        NewPositionFromString("line:185:3"), | ||||
| 			Position2:  "", | ||||
|  | @ -15,7 +16,12 @@ func TestEnumConstantDecl(t *testing.T) { | |||
| 			Type:       "int", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x3c77ba8 <line:59:3, col:65> col:3 referenced _ISalnum 'int'`: &EnumConstantDecl{ | ||||
| 		0x1660db0, | ||||
| 		NewPositionFromString("line:185:3"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x3c77ba8 <line:59:3, col:65> col:3 referenced _ISalnum 'int'`: | ||||
| 		testNode{&EnumConstantDecl{ | ||||
| 			Addr:       0x3c77ba8, | ||||
| 			Pos:        NewPositionFromString("line:59:3, col:65"), | ||||
| 			Position2:  "col:3", | ||||
|  | @ -24,6 +30,10 @@ func TestEnumConstantDecl(t *testing.T) { | |||
| 			Type:       "int", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x3c77ba8, | ||||
| 		NewPositionFromString("line:59:3, col:65"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,21 +5,31 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestEnumDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x22a6c80 <line:180:1, line:186:1> __codecvt_result`: &EnumDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x22a6c80 <line:180:1, line:186:1> __codecvt_result`: | ||||
| 		testNode{&EnumDecl{ | ||||
| 			Addr:       0x22a6c80, | ||||
| 			Pos:        NewPositionFromString("line:180:1, line:186:1"), | ||||
| 			Position2:  "", | ||||
| 			Name:       "__codecvt_result", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x32fb5a0 <enum.c:3:1, col:45> col:6 week`: &EnumDecl{ | ||||
| 		0x22a6c80, | ||||
| 		NewPositionFromString("line:180:1, line:186:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x32fb5a0 <enum.c:3:1, col:45> col:6 week`: | ||||
| 		testNode{&EnumDecl{ | ||||
| 			Addr:       0x32fb5a0, | ||||
| 			Pos:        NewPositionFromString("enum.c:3:1, col:45"), | ||||
| 			Position2:  " col:6", | ||||
| 			Name:       "week", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x32fb5a0, | ||||
| 		NewPositionFromString("enum.c:3:1, col:45"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -13,9 +13,9 @@ func parseEnumExtensibilityAttr(line string) Node { | |||
| 		"<(?P<position>.*)>(?P<content>.*)", | ||||
| 		line, | ||||
| 	) | ||||
|         if groups == nil { | ||||
|                 return &Unknown{} | ||||
|         } | ||||
| 	if groups == nil { | ||||
| 		return &Unknown{} | ||||
| 	} | ||||
| 
 | ||||
| 	return &EnumExtensibilityAttr{ | ||||
| 		Addr:       ParseAddress(groups["address"]), | ||||
|  |  | |||
							
								
								
									
										23
									
								
								ast/enum_extensibility_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/enum_extensibility_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestEnumExtensibilityAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&EnumExtensibilityAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestEnum(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f980b858308 'foo'`: &Enum{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f980b858308 'foo'`: | ||||
| 		testNode{&Enum{ | ||||
| 			Addr:       0x7f980b858308, | ||||
| 			Name:       "foo", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f980b858308, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestEnumType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f980b858309 'foo'`: &EnumType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f980b858309 'foo'`: | ||||
| 		testNode{&EnumType{ | ||||
| 			Addr:       0x7f980b858309, | ||||
| 			Name:       "foo", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f980b858309, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFieldDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fef510c4848 <line:141:2, col:6> col:6 _ur 'int'`: &FieldDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fef510c4848 <line:141:2, col:6> col:6 _ur 'int'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fef510c4848, | ||||
| 			Pos:        NewPositionFromString("line:141:2, col:6"), | ||||
| 			Position2:  "col:6", | ||||
|  | @ -17,7 +18,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510c46f8 <line:139:2, col:16> col:16 _ub 'struct __sbuf':'struct __sbuf'`: &FieldDecl{ | ||||
| 		0x7fef510c4848, | ||||
| 		NewPositionFromString("line:141:2, col:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510c46f8 <line:139:2, col:16> col:16 _ub 'struct __sbuf':'struct __sbuf'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fef510c46f8, | ||||
| 			Pos:        NewPositionFromString("line:139:2, col:16"), | ||||
| 			Position2:  "col:16", | ||||
|  | @ -28,7 +34,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510c3fe0 <line:134:2, col:19> col:19 _read 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`: &FieldDecl{ | ||||
| 		0x7fef510c46f8, | ||||
| 		NewPositionFromString("line:139:2, col:16"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510c3fe0 <line:134:2, col:19> col:19 _read 'int (* _Nullable)(void *, char *, int)':'int (*)(void *, char *, int)'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fef510c3fe0, | ||||
| 			Pos:        NewPositionFromString("line:134:2, col:19"), | ||||
| 			Position2:  "col:19", | ||||
|  | @ -39,7 +50,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fef51073a60 <line:105:2, col:40> col:40 __cleanup_stack 'struct __darwin_pthread_handler_rec *'`: &FieldDecl{ | ||||
| 		0x7fef510c3fe0, | ||||
| 		NewPositionFromString("line:134:2, col:19"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fef51073a60 <line:105:2, col:40> col:40 __cleanup_stack 'struct __darwin_pthread_handler_rec *'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fef51073a60, | ||||
| 			Pos:        NewPositionFromString("line:105:2, col:40"), | ||||
| 			Position2:  "col:40", | ||||
|  | @ -50,7 +66,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510738e8 <line:100:2, col:43> col:7 __opaque 'char [16]'`: &FieldDecl{ | ||||
| 		0x7fef51073a60, | ||||
| 		NewPositionFromString("line:105:2, col:40"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fef510738e8 <line:100:2, col:43> col:7 __opaque 'char [16]'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fef510738e8, | ||||
| 			Pos:        NewPositionFromString("line:100:2, col:43"), | ||||
| 			Position2:  "col:7", | ||||
|  | @ -61,7 +82,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fe9f5072268 <line:129:2, col:6> col:6 referenced _lbfsize 'int'`: &FieldDecl{ | ||||
| 		0x7fef510738e8, | ||||
| 		NewPositionFromString("line:100:2, col:43"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fe9f5072268 <line:129:2, col:6> col:6 referenced _lbfsize 'int'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7fe9f5072268, | ||||
| 			Pos:        NewPositionFromString("line:129:2, col:6"), | ||||
| 			Position2:  "col:6", | ||||
|  | @ -72,7 +98,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short'`: &FieldDecl{ | ||||
| 		0x7fe9f5072268, | ||||
| 		NewPositionFromString("line:129:2, col:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f9bc9083d00 <line:91:5, line:97:8> line:91:5 'unsigned short'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x7f9bc9083d00, | ||||
| 			Pos:        NewPositionFromString("line:91:5, line:97:8"), | ||||
| 			Position2:  "line:91:5", | ||||
|  | @ -83,7 +114,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x30363a0 <col:18, col:29> __val 'int [2]'`: &FieldDecl{ | ||||
| 		0x7f9bc9083d00, | ||||
| 		NewPositionFromString("line:91:5, line:97:8"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x30363a0 <col:18, col:29> __val 'int [2]'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x30363a0, | ||||
| 			Pos:        NewPositionFromString("col:18, col:29"), | ||||
| 			Position2:  "", | ||||
|  | @ -94,7 +130,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x17aeac0 <line:3:9> col:9 implicit referenced 'struct vec3d_t::(anonymous at main.c:3:9)'`: &FieldDecl{ | ||||
| 		0x30363a0, | ||||
| 		NewPositionFromString("col:18, col:29"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x17aeac0 <line:3:9> col:9 implicit referenced 'struct vec3d_t::(anonymous at main.c:3:9)'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x17aeac0, | ||||
| 			Pos:        NewPositionFromString("line:3:9"), | ||||
| 			Position2:  "col:9", | ||||
|  | @ -105,7 +146,12 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x56498bf52160 <line:269:5, col:21> col:21 type 'enum __pid_type':'enum __pid_type'`: &FieldDecl{ | ||||
| 		0x17aeac0, | ||||
| 		NewPositionFromString("line:3:9"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x56498bf52160 <line:269:5, col:21> col:21 type 'enum __pid_type':'enum __pid_type'`: | ||||
| 		testNode{&FieldDecl{ | ||||
| 			Addr:       0x56498bf52160, | ||||
| 			Pos:        NewPositionFromString("line:269:5, col:21"), | ||||
| 			Position2:  "col:21", | ||||
|  | @ -116,6 +162,10 @@ func TestFieldDecl(t *testing.T) { | |||
| 			Referenced: false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x56498bf52160, | ||||
| 		NewPositionFromString("line:269:5, col:21"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestField(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x44159a0 '' 'union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)'`: &Field{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x44159a0 '' 'union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)'`: | ||||
| 		testNode{&Field{ | ||||
| 			Addr:       0x44159a0, | ||||
| 			String1:    "", | ||||
| 			String2:    "union sigcontext::(anonymous at /usr/include/x86_64-linux-gnu/bits/sigcontext.h:165:17)", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x44159a0, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -2,48 +2,48 @@ package ast | |||
| 
 | ||||
| // FlagEnumAttr
 | ||||
| type FlagEnumAttr struct { | ||||
| 	Addr       Address | ||||
| 	Pos        Position | ||||
| 	Content    string | ||||
| 	ChildNodes []Node | ||||
|         Addr       Address | ||||
|         Pos        Position | ||||
|         Content    string | ||||
|         ChildNodes []Node | ||||
| } | ||||
| 
 | ||||
| func parseFlagEnumAttr(line string) Node { | ||||
| 	groups := groupsFromRegex( | ||||
| 		"<(?P<position>.*)>(?P<content>.*)", | ||||
| 		line, | ||||
| 	) | ||||
|         groups := groupsFromRegex( | ||||
|                 "<(?P<position>.*)>(?P<content>.*)", | ||||
|                 line, | ||||
|         ) | ||||
|         if groups == nil { | ||||
|                 return &Unknown{} | ||||
|         } | ||||
| 
 | ||||
| 	return &FlagEnumAttr{ | ||||
| 		Addr:       ParseAddress(groups["address"]), | ||||
| 		Pos:        NewPositionFromString(groups["position"]), | ||||
| 		Content:    groups["content"], | ||||
| 		ChildNodes: []Node{}, | ||||
| 	} | ||||
|         return &FlagEnumAttr{ | ||||
|                 Addr:       ParseAddress(groups["address"]), | ||||
|                 Pos:        NewPositionFromString(groups["position"]), | ||||
|                 Content:    groups["content"], | ||||
|                 ChildNodes: []Node{}, | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| // AddChild adds a new child node. Child nodes can then be accessed with the
 | ||||
| // Children attribute.
 | ||||
| func (n *FlagEnumAttr) AddChild(node Node) { | ||||
| 	n.ChildNodes = append(n.ChildNodes, node) | ||||
|         n.ChildNodes = append(n.ChildNodes, node) | ||||
| } | ||||
| 
 | ||||
| // Address returns the numeric address of the node. See the documentation for
 | ||||
| // the Address type for more information.
 | ||||
| func (n *FlagEnumAttr) Address() Address { | ||||
| 	return n.Addr | ||||
|         return n.Addr | ||||
| } | ||||
| 
 | ||||
| // Children returns the child nodes. If this node does not have any children or
 | ||||
| // this node does not support children it will always return an empty slice.
 | ||||
| func (n *FlagEnumAttr) Children() []Node { | ||||
| 	return n.ChildNodes | ||||
|         return n.ChildNodes | ||||
| } | ||||
| 
 | ||||
| // Position returns the position in the original source code.
 | ||||
| func (n *FlagEnumAttr) Position() Position { | ||||
| 	return n.Pos | ||||
|         return n.Pos | ||||
| } | ||||
|  |  | |||
							
								
								
									
										23
									
								
								ast/flag_enum_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/flag_enum_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestFlagEnumAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&FlagEnumAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,21 +5,31 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFloatingLiteral(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: &FloatingLiteral{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7febe106f5e8 <col:24> 'double' 1.230000e+00`: | ||||
| 		testNode{&FloatingLiteral{ | ||||
| 			Addr:       0x7febe106f5e8, | ||||
| 			Pos:        NewPositionFromString("col:24"), | ||||
| 			Type:       "double", | ||||
| 			Value:      1.23, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x21c65b8 <col:41> 'double' 2.718282e+00`: &FloatingLiteral{ | ||||
| 		0x7febe106f5e8, | ||||
| 		NewPositionFromString("col:24"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x21c65b8 <col:41> 'double' 2.718282e+00`: | ||||
| 		testNode{&FloatingLiteral{ | ||||
| 			Addr:       0x21c65b8, | ||||
| 			Pos:        NewPositionFromString("col:41"), | ||||
| 			Type:       "double", | ||||
| 			Value:      2.718282e+00, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x21c65b8, | ||||
| 		NewPositionFromString("col:41"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestForStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f961e018848 <line:9:4, line:10:70>`: &ForStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f961e018848 <line:9:4, line:10:70>`: | ||||
| 		testNode{&ForStmt{ | ||||
| 			Addr:       0x7f961e018848, | ||||
| 			Pos:        NewPositionFromString("line:9:4, line:10:70"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f961e018848, | ||||
| 		NewPositionFromString("line:9:4, line:10:70"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFormatArgAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f1234567890 <col:47, col:57> 1`: &FormatArgAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f1234567890 <col:47, col:57> 1`: | ||||
| 		testNode{&FormatArgAttr{ | ||||
| 			Addr:       0x7f1234567890, | ||||
| 			Pos:        NewPositionFromString("col:47, col:57"), | ||||
| 			Arg:        "1", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f1234567890, | ||||
| 		NewPositionFromString("col:47, col:57"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFormatAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fcc8d8ecee8 <col:6> Implicit printf 2 3`: &FormatAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fcc8d8ecee8 <col:6> Implicit printf 2 3`: | ||||
| 		testNode{&FormatAttr{ | ||||
| 			Addr:         0x7fcc8d8ecee8, | ||||
| 			Pos:          NewPositionFromString("col:6"), | ||||
| 			Implicit:     true, | ||||
|  | @ -16,7 +17,12 @@ func TestFormatAttr(t *testing.T) { | |||
| 			Unknown2:     3, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fcc8d8ecff8 </usr/include/sys/cdefs.h:351:18, col:61> printf 2 3`: &FormatAttr{ | ||||
| 		0x7fcc8d8ecee8, | ||||
| 		NewPositionFromString("col:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fcc8d8ecff8 </usr/include/sys/cdefs.h:351:18, col:61> printf 2 3`: | ||||
| 		testNode{&FormatAttr{ | ||||
| 			Addr:         0x7fcc8d8ecff8, | ||||
| 			Pos:          NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"), | ||||
| 			Implicit:     false, | ||||
|  | @ -26,7 +32,12 @@ func TestFormatAttr(t *testing.T) { | |||
| 			Unknown2:     3, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x273b4d0 <line:357:12> Inherited printf 2 3`: &FormatAttr{ | ||||
| 		0x7fcc8d8ecff8, | ||||
| 		NewPositionFromString("/usr/include/sys/cdefs.h:351:18, col:61"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x273b4d0 <line:357:12> Inherited printf 2 3`: | ||||
| 		testNode{&FormatAttr{ | ||||
| 			Addr:         0x273b4d0, | ||||
| 			Pos:          NewPositionFromString("line:357:12"), | ||||
| 			Implicit:     false, | ||||
|  | @ -36,6 +47,10 @@ func TestFormatAttr(t *testing.T) { | |||
| 			Unknown2:     3, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x273b4d0, | ||||
| 		NewPositionFromString("line:357:12"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFullComment(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x3860920 <line:10176:4, line:10180:45>`: &FullComment{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x3860920 <line:10176:4, line:10180:45>`: | ||||
| 		testNode{&FullComment{ | ||||
| 			Addr:       0x3860920, | ||||
| 			Pos:        NewPositionFromString("line:10176:4, line:10180:45"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x3860920, | ||||
| 		NewPositionFromString("line:10176:4, line:10180:45"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFunctionDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fb5a90e60d0 <line:231:1, col:22> col:7 clearerr 'void (FILE *)'`: &FunctionDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fb5a90e60d0 <line:231:1, col:22> col:7 clearerr 'void (FILE *)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fb5a90e60d0, | ||||
| 			Pos:          NewPositionFromString("line:231:1, col:22"), | ||||
| 			Prev:         "", | ||||
|  | @ -22,7 +23,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e2a50 </usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126> /usr/include/sys/stdio.h:39:5 renameat 'int (int, const char *, int, const char *)'`: &FunctionDecl{ | ||||
| 		0x7fb5a90e60d0, | ||||
| 		NewPositionFromString("line:231:1, col:22"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e2a50 </usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126> /usr/include/sys/stdio.h:39:5 renameat 'int (int, const char *, int, const char *)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fb5a90e2a50, | ||||
| 			Pos:          NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"), | ||||
| 			Prev:         "", | ||||
|  | @ -38,7 +44,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e9b70 </usr/include/stdio.h:244:6> col:6 implicit fprintf 'int (FILE *, const char *, ...)' extern`: &FunctionDecl{ | ||||
| 		0x7fb5a90e2a50, | ||||
| 		NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e9b70 </usr/include/stdio.h:244:6> col:6 implicit fprintf 'int (FILE *, const char *, ...)' extern`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fb5a90e9b70, | ||||
| 			Pos:          NewPositionFromString("/usr/include/stdio.h:244:6"), | ||||
| 			Prev:         "", | ||||
|  | @ -54,7 +65,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e9d40 prev 0x7fb5a90e9b70 <col:1, /usr/include/sys/cdefs.h:351:63> /usr/include/stdio.h:244:6 fprintf 'int (FILE *, const char *, ...)'`: &FunctionDecl{ | ||||
| 		0x7fb5a90e9b70, | ||||
| 		NewPositionFromString("/usr/include/stdio.h:244:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90e9d40 prev 0x7fb5a90e9b70 <col:1, /usr/include/sys/cdefs.h:351:63> /usr/include/stdio.h:244:6 fprintf 'int (FILE *, const char *, ...)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fb5a90e9d40, | ||||
| 			Pos:          NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"), | ||||
| 			Prev:         "0x7fb5a90e9b70", | ||||
|  | @ -70,7 +86,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90ec210 <line:259:6> col:6 implicit used printf 'int (const char *, ...)' extern`: &FunctionDecl{ | ||||
| 		0x7fb5a90e9d40, | ||||
| 		NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fb5a90ec210 <line:259:6> col:6 implicit used printf 'int (const char *, ...)' extern`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fb5a90ec210, | ||||
| 			Pos:          NewPositionFromString("line:259:6"), | ||||
| 			Prev:         "", | ||||
|  | @ -86,7 +107,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x2ae30d8 </usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54> <scratch space>:17:1 __acos 'double (double)' extern`: &FunctionDecl{ | ||||
| 		0x7fb5a90ec210, | ||||
| 		NewPositionFromString("line:259:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x2ae30d8 </usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54> <scratch space>:17:1 __acos 'double (double)' extern`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x2ae30d8, | ||||
| 			Pos:          NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"), | ||||
| 			Prev:         "", | ||||
|  | @ -102,7 +128,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x7fc595071500 <line:26:1, line:69:1> line:26:5 referenced main 'int (int, char **)'`: &FunctionDecl{ | ||||
| 		0x2ae30d8, | ||||
| 		NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fc595071500 <line:26:1, line:69:1> line:26:5 referenced main 'int (int, char **)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x7fc595071500, | ||||
| 			Pos:          NewPositionFromString("line:26:1, line:69:1"), | ||||
| 			Prev:         "", | ||||
|  | @ -118,7 +149,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x55973a008cb0 <line:93619:1, line:93630:1> line:93619:12 used exprIsConst 'int (Expr *, int, int)' static`: &FunctionDecl{ | ||||
| 		0x7fc595071500, | ||||
| 		NewPositionFromString("line:26:1, line:69:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x55973a008cb0 <line:93619:1, line:93630:1> line:93619:12 used exprIsConst 'int (Expr *, int, int)' static`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x55973a008cb0, | ||||
| 			Pos:          NewPositionFromString("line:93619:1, line:93630:1"), | ||||
| 			Prev:         "", | ||||
|  | @ -134,7 +170,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x563ade547cb8 <safe_math.h:13:1, line:25:1> line:14:2 safe_unary_minus_func_int8_t_s 'int8_t (int8_t)':'int8_t (int8_t)' static`: &FunctionDecl{ | ||||
| 		0x55973a008cb0, | ||||
| 		NewPositionFromString("line:93619:1, line:93630:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x563ade547cb8 <safe_math.h:13:1, line:25:1> line:14:2 safe_unary_minus_func_int8_t_s 'int8_t (int8_t)':'int8_t (int8_t)' static`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x563ade547cb8, | ||||
| 			Pos:          NewPositionFromString("safe_math.h:13:1, line:25:1"), | ||||
| 			Prev:         "", | ||||
|  | @ -150,7 +191,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x556cac571be0 <tests/asm.c:9:1, line:13:1> line:9:26 sqlite3Hwtime1 'unsigned long (void)' inline`: &FunctionDecl{ | ||||
| 		0x563ade547cb8, | ||||
| 		NewPositionFromString("safe_math.h:13:1, line:25:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x556cac571be0 <tests/asm.c:9:1, line:13:1> line:9:26 sqlite3Hwtime1 'unsigned long (void)' inline`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x556cac571be0, | ||||
| 			Pos:          NewPositionFromString("tests/asm.c:9:1, line:13:1"), | ||||
| 			Prev:         "", | ||||
|  | @ -166,7 +212,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     true, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x21c3da0 <line:8201:1, line:8786:1> line:8201:25 used insertvertex 'enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)'`: &FunctionDecl{ | ||||
| 		0x556cac571be0, | ||||
| 		NewPositionFromString("tests/asm.c:9:1, line:13:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x21c3da0 <line:8201:1, line:8786:1> line:8201:25 used insertvertex 'enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x21c3da0, | ||||
| 			Pos:          NewPositionFromString("line:8201:1, line:8786:1"), | ||||
| 			Prev:         "", | ||||
|  | @ -182,7 +233,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x30bdba8 parent 0x304fbb0 <col:3, col:38> col:30 used getinfo 'enum countries ()'`: &FunctionDecl{ | ||||
| 		0x21c3da0, | ||||
| 		NewPositionFromString("line:8201:1, line:8786:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x30bdba8 parent 0x304fbb0 <col:3, col:38> col:30 used getinfo 'enum countries ()'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x30bdba8, | ||||
| 			Pos:          NewPositionFromString("col:3, col:38"), | ||||
| 			Prev:         "", | ||||
|  | @ -199,7 +255,12 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		`0x353d3b8 parent 0x31e9ba0 prev 0x33b0810 <col:2, col:30> col:22 used dmatrix 'double **(long, long, long, long)'`: &FunctionDecl{ | ||||
| 		0x30bdba8, | ||||
| 		NewPositionFromString("col:3, col:38"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x353d3b8 parent 0x31e9ba0 prev 0x33b0810 <col:2, col:30> col:22 used dmatrix 'double **(long, long, long, long)'`: | ||||
| 		testNode{&FunctionDecl{ | ||||
| 			Addr:         0x353d3b8, | ||||
| 			Pos:          NewPositionFromString("col:2, col:30"), | ||||
| 			Prev:         "0x33b0810", | ||||
|  | @ -216,6 +277,10 @@ func TestFunctionDecl(t *testing.T) { | |||
| 			IsInline:     false, | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x353d3b8, | ||||
| 		NewPositionFromString("col:2, col:30"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestFunctionProtoType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fa3b88bbb30 'struct _opaque_pthread_t *' foo`: &FunctionProtoType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fa3b88bbb30 'struct _opaque_pthread_t *' foo`: | ||||
| 		testNode{&FunctionProtoType{ | ||||
| 			Addr:       0x7fa3b88bbb30, | ||||
| 			Type:       "struct _opaque_pthread_t *", | ||||
| 			Kind:       "foo", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fa3b88bbb30, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestGCCAsmStmtStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fad830c9e38 <line:13:5, col:57>`: &GCCAsmStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fad830c9e38 <line:13:5, col:57>`: | ||||
| 		testNode{&GCCAsmStmt{ | ||||
| 			Addr:       0x7fad830c9e38, | ||||
| 			Pos:        NewPositionFromString("line:13:5, col:57"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fad830c9e38, | ||||
| 		NewPositionFromString("line:13:5, col:57"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,14 +5,19 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestGotoStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fb9cc1994d8 <line:18893:9, col:14> 'end_getDigits' 0x7fb9cc199490`: &GotoStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fb9cc1994d8 <line:18893:9, col:14> 'end_getDigits' 0x7fb9cc199490`: | ||||
| 		testNode{&GotoStmt{ | ||||
| 			Addr:       0x7fb9cc1994d8, | ||||
| 			Pos:        NewPositionFromString("line:18893:9, col:14"), | ||||
| 			Name:       "end_getDigits", | ||||
| 			Position2:  "0x7fb9cc199490", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fb9cc1994d8, | ||||
| 		NewPositionFromString("line:18893:9, col:14"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestHTMLEndTagComment(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x4259670 <col:27, col:30> Name="i"`: &HTMLEndTagComment{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x4259670 <col:27, col:30> Name="i"`: | ||||
| 		testNode{&HTMLEndTagComment{ | ||||
| 			Addr:       0x4259670, | ||||
| 			Pos:        NewPositionFromString("col:27, col:30"), | ||||
| 			Name:       "i", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x4259670, | ||||
| 		NewPositionFromString("col:27, col:30"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestHTMLStartTagComment(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x4259670 <col:27, col:30> Name="i"`: &HTMLStartTagComment{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x4259670 <col:27, col:30> Name="i"`: | ||||
| 		testNode{&HTMLStartTagComment{ | ||||
| 			Addr:       0x4259670, | ||||
| 			Pos:        NewPositionFromString("col:27, col:30"), | ||||
| 			Name:       "i", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x4259670, | ||||
| 		NewPositionFromString("col:27, col:30"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										22
									
								
								ast/ib_action_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/ib_action_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestIBActionAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&IBActionAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/ib_outlet_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/ib_outlet_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestIBOutletAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&IBOutletAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestIfStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc0a69091d0 <line:11:7, line:18:7>`: &IfStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d0 <line:11:7, line:18:7>`: | ||||
| 		testNode{&IfStmt{ | ||||
| 			Addr:       0x7fc0a69091d0, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d0, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,22 +5,33 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestImplicitCastExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f9f5b0a1288 <col:8> 'FILE *' <LValueToRValue>`: &ImplicitCastExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f9f5b0a1288 <col:8> 'FILE *' <LValueToRValue>`: | ||||
| 		testNode{&ImplicitCastExpr{ | ||||
| 			Addr:       0x7f9f5b0a1288, | ||||
| 			Pos:        NewPositionFromString("col:8"), | ||||
| 			Type:       "FILE *", | ||||
| 			Kind:       "LValueToRValue", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f9f5b0a7828 <col:11> 'int (*)(int, FILE *)' <FunctionToPointerDecay>`: &ImplicitCastExpr{ | ||||
| 		0x7f9f5b0a1288, | ||||
| 		NewPositionFromString("col:8"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f9f5b0a7828 <col:11> 'int (*)(int, FILE *)' <FunctionToPointerDecay>`: | ||||
| 		testNode{&ImplicitCastExpr{ | ||||
| 			Addr:       0x7f9f5b0a7828, | ||||
| 			Pos:        NewPositionFromString("col:11"), | ||||
| 			Type:       "int (*)(int, FILE *)", | ||||
| 			Kind:       "FunctionToPointerDecay", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x21267c8 <col:8> 'enum week1':'enum week2' <IntegralCast>`: &ImplicitCastExpr{ | ||||
| 		0x7f9f5b0a7828, | ||||
| 		NewPositionFromString("col:11"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x21267c8 <col:8> 'enum week1':'enum week2' <IntegralCast>`: | ||||
| 		testNode{&ImplicitCastExpr{ | ||||
| 			Addr:       0x21267c8, | ||||
| 			Pos:        NewPositionFromString("col:8"), | ||||
| 			Type:       "enum week1", | ||||
|  | @ -28,7 +39,12 @@ func TestImplicitCastExpr(t *testing.T) { | |||
| 			Kind:       "IntegralCast", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x26fd2d8 <col:20, col:32> 'extCoord':'extCoord' <LValueToRValue>`: &ImplicitCastExpr{ | ||||
| 		0x21267c8, | ||||
| 		NewPositionFromString("col:8"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x26fd2d8 <col:20, col:32> 'extCoord':'extCoord' <LValueToRValue>`: | ||||
| 		testNode{&ImplicitCastExpr{ | ||||
| 			Addr:       0x26fd2d8, | ||||
| 			Pos:        NewPositionFromString("col:20, col:32"), | ||||
| 			Type:       "extCoord", | ||||
|  | @ -36,6 +52,10 @@ func TestImplicitCastExpr(t *testing.T) { | |||
| 			Kind:       "LValueToRValue", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x26fd2d8, | ||||
| 		NewPositionFromString("col:20, col:32"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,21 +5,31 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestImplicitValueInitExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f8c3396fbd8 <<invalid sloc>> 'sqlite3StatValueType':'long long'`: &ImplicitValueInitExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f8c3396fbd8 <<invalid sloc>> 'sqlite3StatValueType':'long long'`: | ||||
| 		testNode{&ImplicitValueInitExpr{ | ||||
| 			Addr:       0x7f8c3396fbd8, | ||||
| 			Pos:        NewPositionFromString("<invalid sloc>"), | ||||
| 			Type1:      "sqlite3StatValueType", | ||||
| 			Type2:      "long long", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7feecb0d6af0 <<invalid sloc>> 'char'`: &ImplicitValueInitExpr{ | ||||
| 		0x7f8c3396fbd8, | ||||
| 		NewPositionFromString("<invalid sloc>"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7feecb0d6af0 <<invalid sloc>> 'char'`: | ||||
| 		testNode{&ImplicitValueInitExpr{ | ||||
| 			Addr:       0x7feecb0d6af0, | ||||
| 			Pos:        NewPositionFromString("<invalid sloc>"), | ||||
| 			Type1:      "char", | ||||
| 			Type2:      "", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7feecb0d6af0, | ||||
| 		NewPositionFromString("<invalid sloc>"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestIncompleteArrayType(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fcb7d005c20 'int []' `: &IncompleteArrayType{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fcb7d005c20 'int []' `: | ||||
| 		testNode{&IncompleteArrayType{ | ||||
| 			Addr:       0x7fcb7d005c20, | ||||
| 			Type:       "int []", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fcb7d005c20, | ||||
| 		NewPositionFromString(""), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestIndirectFieldDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x2be19a8 <line:167:25> col:25 implicit fpstate 'struct _fpstate *'`: &IndirectFieldDecl{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x2be19a8 <line:167:25> col:25 implicit fpstate 'struct _fpstate *'`: | ||||
| 		testNode{&IndirectFieldDecl{ | ||||
| 			Addr:       0x2be19a8, | ||||
| 			Pos:        NewPositionFromString("line:167:25"), | ||||
| 			Position2:  "col:25", | ||||
|  | @ -15,6 +16,10 @@ func TestIndirectFieldDecl(t *testing.T) { | |||
| 			Type:       "struct _fpstate *", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x2be19a8, | ||||
| 		NewPositionFromString("line:167:25"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,26 +5,41 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestInitListExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fbdd1906c20 <col:52, line:17160:1> 'const unsigned char [256]'`: &InitListExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fbdd1906c20 <col:52, line:17160:1> 'const unsigned char [256]'`: | ||||
| 		testNode{&InitListExpr{ | ||||
| 			Addr:       0x7fbdd1906c20, | ||||
| 			Pos:        NewPositionFromString("col:52, line:17160:1"), | ||||
| 			Type1:      "const unsigned char [256]", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x32017f0 <col:24, col:41> 'struct node [2]'`: &InitListExpr{ | ||||
| 		0x7fbdd1906c20, | ||||
| 		NewPositionFromString("col:52, line:17160:1"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x32017f0 <col:24, col:41> 'struct node [2]'`: | ||||
| 		testNode{&InitListExpr{ | ||||
| 			Addr:       0x32017f0, | ||||
| 			Pos:        NewPositionFromString("col:24, col:41"), | ||||
| 			Type1:      "struct node [2]", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x3201840 <col:25, col:31> 'struct node':'struct node'`: &InitListExpr{ | ||||
| 		0x32017f0, | ||||
| 		NewPositionFromString("col:24, col:41"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x3201840 <col:25, col:31> 'struct node':'struct node'`: | ||||
| 		testNode{&InitListExpr{ | ||||
| 			Addr:       0x3201840, | ||||
| 			Pos:        NewPositionFromString("col:25, col:31"), | ||||
| 			Type1:      "struct node", | ||||
| 			Type2:      "struct node", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x3201840, | ||||
| 		NewPositionFromString("col:25, col:31"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestInlineCommandComment(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x22e3510 <col:2, col:6> Name="NOTE" RenderNormal`: &InlineCommandComment{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x22e3510 <col:2, col:6> Name="NOTE" RenderNormal`: | ||||
| 		testNode{&InlineCommandComment{ | ||||
| 			Addr:       0x22e3510, | ||||
| 			Pos:        NewPositionFromString("col:2, col:6"), | ||||
| 			Other:      "Name=\"NOTE\" RenderNormal", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x22e3510, | ||||
| 		NewPositionFromString("col:2, col:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,14 +5,19 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestIntegerLiteral(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fbe9804bcc8 <col:14> 'int' 1`: &IntegerLiteral{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fbe9804bcc8 <col:14> 'int' 1`: | ||||
| 		testNode{&IntegerLiteral{ | ||||
| 			Addr:       0x7fbe9804bcc8, | ||||
| 			Pos:        NewPositionFromString("col:14"), | ||||
| 			Type:       "int", | ||||
| 			Value:      "1", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fbe9804bcc8, | ||||
| 		NewPositionFromString("col:14"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestLabelStmt(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fe3ba82edb8 <line:18906:1, line:18907:22> 'end_getDigits'`: &LabelStmt{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fe3ba82edb8 <line:18906:1, line:18907:22> 'end_getDigits'`: | ||||
| 		testNode{&LabelStmt{ | ||||
| 			Addr:       0x7fe3ba82edb8, | ||||
| 			Pos:        NewPositionFromString("line:18906:1, line:18907:22"), | ||||
| 			Name:       "end_getDigits", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fe3ba82edb8, | ||||
| 		NewPositionFromString("line:18906:1, line:18907:22"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestMallocAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: &MallocAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&MallocAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,19 +5,29 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestMaxFieldAlignmentAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fd4b7063ac0 <<invalid sloc>> Implicit 32`: &MaxFieldAlignmentAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fd4b7063ac0 <<invalid sloc>> Implicit 32`: | ||||
| 		testNode{&MaxFieldAlignmentAttr{ | ||||
| 			Addr:       0x7fd4b7063ac0, | ||||
| 			Pos:        NewPositionFromString("<invalid sloc>"), | ||||
| 			Size:       32, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fd4b7063ac0 <<invalid sloc>> Implicit 8`: &MaxFieldAlignmentAttr{ | ||||
| 		0x7fd4b7063ac0, | ||||
| 		NewPositionFromString("<invalid sloc>"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fd4b7063ac0 <<invalid sloc>> Implicit 8`: | ||||
| 		testNode{&MaxFieldAlignmentAttr{ | ||||
| 			Addr:       0x7fd4b7063ac0, | ||||
| 			Pos:        NewPositionFromString("<invalid sloc>"), | ||||
| 			Size:       8, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fd4b7063ac0, | ||||
| 		NewPositionFromString("<invalid sloc>"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										22
									
								
								ast/may_alias_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/may_alias_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestMayAliasAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&MayAliasAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -55,6 +55,7 @@ func (n *MemberExpr) AddChild(node Node) { | |||
| 	n.ChildNodes = append(n.ChildNodes, node) | ||||
| } | ||||
| 
 | ||||
| /* | ||||
| // GetDeclRefExpr gets DeclRefExpr from MemberExpr, or nil if there is no
 | ||||
| // DeclRefExpr
 | ||||
| func (n *MemberExpr) GetDeclRefExpr() *DeclRefExpr { | ||||
|  | @ -77,6 +78,7 @@ func (n *MemberExpr) GetDeclRefExpr() *DeclRefExpr { | |||
| 	// There is no DeclRefExpr
 | ||||
| 	return nil | ||||
| } | ||||
| */ | ||||
| 
 | ||||
| // Address returns the numeric address of the node. See the documentation for
 | ||||
| // the Address type for more information.
 | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestMemberExpr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fcc758e34a0 <col:8, col:12> 'int' lvalue ->_w 0x7fcc758d60c8`: &MemberExpr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fcc758e34a0 <col:8, col:12> 'int' lvalue ->_w 0x7fcc758d60c8`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x7fcc758e34a0, | ||||
| 			Pos:        NewPositionFromString("col:8, col:12"), | ||||
| 			Type:       "int", | ||||
|  | @ -18,7 +19,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fcc76004210 <col:12, col:16> 'unsigned char *' lvalue ->_p 0x7fcc758d6018`: &MemberExpr{ | ||||
| 		0x7fcc758e34a0, | ||||
| 		NewPositionFromString("col:8, col:12"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fcc76004210 <col:12, col:16> 'unsigned char *' lvalue ->_p 0x7fcc758d6018`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x7fcc76004210, | ||||
| 			Pos:        NewPositionFromString("col:12, col:16"), | ||||
| 			Type:       "unsigned char *", | ||||
|  | @ -30,7 +36,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f85338325b0 <col:4, col:13> 'float' lvalue .constant 0x7f8533832260`: &MemberExpr{ | ||||
| 		0x7fcc76004210, | ||||
| 		NewPositionFromString("col:12, col:16"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f85338325b0 <col:4, col:13> 'float' lvalue .constant 0x7f8533832260`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x7f85338325b0, | ||||
| 			Pos:        NewPositionFromString("col:4, col:13"), | ||||
| 			Type:       "float", | ||||
|  | @ -42,7 +53,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7f8533832670 <col:4, col:13> 'char *' lvalue .pointer 0x7f85338322b8`: &MemberExpr{ | ||||
| 		0x7f85338325b0, | ||||
| 		NewPositionFromString("col:4, col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7f8533832670 <col:4, col:13> 'char *' lvalue .pointer 0x7f85338322b8`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x7f8533832670, | ||||
| 			Pos:        NewPositionFromString("col:4, col:13"), | ||||
| 			Type:       "char *", | ||||
|  | @ -54,7 +70,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x7fb7d5a49ac8 <col:3, col:6> 'bft':'unsigned int' lvalue bitfield ->isPrepareV2 0x7fb7d5967f40`: &MemberExpr{ | ||||
| 		0x7f8533832670, | ||||
| 		NewPositionFromString("col:4, col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fb7d5a49ac8 <col:3, col:6> 'bft':'unsigned int' lvalue bitfield ->isPrepareV2 0x7fb7d5967f40`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x7fb7d5a49ac8, | ||||
| 			Pos:        NewPositionFromString("col:3, col:6"), | ||||
| 			Type:       "bft", | ||||
|  | @ -66,7 +87,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  true, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x2914fb8 <col:12, col:14> 'union vec3d_t::(anonymous at main.c:2:5)' lvalue . 0x2914920`: &MemberExpr{ | ||||
| 		0x7fb7d5a49ac8, | ||||
| 		NewPositionFromString("col:3, col:6"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x2914fb8 <col:12, col:14> 'union vec3d_t::(anonymous at main.c:2:5)' lvalue . 0x2914920`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x2914fb8, | ||||
| 			Pos:        NewPositionFromString("col:12, col:14"), | ||||
| 			Type:       "union vec3d_t::(anonymous at main.c:2:5)", | ||||
|  | @ -78,7 +104,12 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x3180ef0 <col:32, col:48> 'int' .n 0x317f450`: &MemberExpr{ | ||||
| 		0x2914fb8, | ||||
| 		NewPositionFromString("col:12, col:14"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x3180ef0 <col:32, col:48> 'int' .n 0x317f450`: | ||||
| 		testNode{&MemberExpr{ | ||||
| 			Addr:       0x3180ef0, | ||||
| 			Pos:        NewPositionFromString("col:32, col:48"), | ||||
| 			Type:       "int", | ||||
|  | @ -90,6 +121,10 @@ func TestMemberExpr(t *testing.T) { | |||
| 			IsPointer:  false, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x3180ef0, | ||||
| 		NewPositionFromString("col:32, col:48"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -2,48 +2,48 @@ package ast | |||
| 
 | ||||
| // MinVectorWidthAttr
 | ||||
| type MinVectorWidthAttr struct { | ||||
| 	Addr       Address | ||||
| 	Pos        Position | ||||
| 	Content    string | ||||
| 	ChildNodes []Node | ||||
|         Addr       Address | ||||
|         Pos        Position | ||||
|         Content    string | ||||
|         ChildNodes []Node | ||||
| } | ||||
| 
 | ||||
| func parseMinVectorWidthAttr(line string) Node { | ||||
| 	groups := groupsFromRegex( | ||||
| 		"<(?P<position>.*)>(?P<content>.*)", | ||||
| 		line, | ||||
| 	) | ||||
|         groups := groupsFromRegex( | ||||
|                 "<(?P<position>.*)>(?P<content>.*)", | ||||
|                 line, | ||||
|         ) | ||||
|         if groups == nil { | ||||
|                 return &Unknown{} | ||||
|         } | ||||
| 
 | ||||
| 	return &MinVectorWidthAttr{ | ||||
| 		Addr:       ParseAddress(groups["address"]), | ||||
| 		Pos:        NewPositionFromString(groups["position"]), | ||||
| 		Content:    groups["content"], | ||||
| 		ChildNodes: []Node{}, | ||||
| 	} | ||||
|         return &MinVectorWidthAttr{ | ||||
|                 Addr:       ParseAddress(groups["address"]), | ||||
|                 Pos:        NewPositionFromString(groups["position"]), | ||||
|                 Content:    groups["content"], | ||||
|                 ChildNodes: []Node{}, | ||||
|         } | ||||
| } | ||||
| 
 | ||||
| // AddChild adds a new child node. Child nodes can then be accessed with the
 | ||||
| // Children attribute.
 | ||||
| func (n *MinVectorWidthAttr) AddChild(node Node) { | ||||
| 	n.ChildNodes = append(n.ChildNodes, node) | ||||
|         n.ChildNodes = append(n.ChildNodes, node) | ||||
| } | ||||
| 
 | ||||
| // Address returns the numeric address of the node. See the documentation for
 | ||||
| // the Address type for more information.
 | ||||
| func (n *MinVectorWidthAttr) Address() Address { | ||||
| 	return n.Addr | ||||
|         return n.Addr | ||||
| } | ||||
| 
 | ||||
| // Children returns the child nodes. If this node does not have any children or
 | ||||
| // this node does not support children it will always return an empty slice.
 | ||||
| func (n *MinVectorWidthAttr) Children() []Node { | ||||
| 	return n.ChildNodes | ||||
|         return n.ChildNodes | ||||
| } | ||||
| 
 | ||||
| // Position returns the position in the original source code.
 | ||||
| func (n *MinVectorWidthAttr) Position() Position { | ||||
| 	return n.Pos | ||||
|         return n.Pos | ||||
| } | ||||
|  |  | |||
							
								
								
									
										23
									
								
								ast/min_vector_width_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/min_vector_width_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestMinVectorWidthAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&MinVectorWidthAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,13 +5,18 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func Test(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7f980b858309 <line:11:7, line:18:7> foo`: &ModeAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7f980b858309 <line:11:7, line:18:7> foo`: | ||||
| 		testNode{&ModeAttr{ | ||||
| 			Addr:       0x7f980b858309, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Name:       "foo", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7f980b858309, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										22
									
								
								ast/no_debug_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/no_debug_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNoDebugAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&NoDebugAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/no_escape_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/no_escape_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNoEscapeAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&NoEscapeAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestNoInlineAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc02a8a6730 <line:24619:23>`: &NoInlineAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc02a8a6730 <line:24619:23>`: | ||||
| 		testNode{&NoInlineAttr{ | ||||
| 			Addr:       0x7fc02a8a6730, | ||||
| 			Pos:        NewPositionFromString("line:24619:23"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc02a8a6730, | ||||
| 		NewPositionFromString("line:24619:23"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,35 +5,55 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestNoThrowAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fa1488273a0 <line:7:4, line:11:4>`: &NoThrowAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fa1488273a0 <line:7:4, line:11:4>`: | ||||
| 		testNode{&NoThrowAttr{ | ||||
| 			Addr:       0x7fa1488273a0, | ||||
| 			Pos:        NewPositionFromString("line:7:4, line:11:4"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 			Inherited:  false, | ||||
| 			Implicit:   false, | ||||
| 		}, | ||||
| 		`0x5605ceaf4b88 <col:12> Implicit`: &NoThrowAttr{ | ||||
| 		0x7fa1488273a0, | ||||
| 		NewPositionFromString("line:7:4, line:11:4"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x5605ceaf4b88 <col:12> Implicit`: | ||||
| 		testNode{&NoThrowAttr{ | ||||
| 			Addr:       0x5605ceaf4b88, | ||||
| 			Pos:        NewPositionFromString("col:12"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 			Inherited:  false, | ||||
| 			Implicit:   true, | ||||
| 		}, | ||||
| 		`0x4153c50 </usr/include/unistd.h:779:46> Inherited`: &NoThrowAttr{ | ||||
| 		0x5605ceaf4b88, | ||||
| 		NewPositionFromString("col:12"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x4153c50 </usr/include/unistd.h:779:46> Inherited`: | ||||
| 		testNode{&NoThrowAttr{ | ||||
| 			Addr:       0x4153c50, | ||||
| 			Pos:        NewPositionFromString("/usr/include/unistd.h:779:46"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 			Inherited:  true, | ||||
| 			Implicit:   false, | ||||
| 		}, | ||||
| 		`0x1038b8828 <col:20> Inherited Implicit`: &NoThrowAttr{ | ||||
| 		0x4153c50, | ||||
| 		NewPositionFromString("/usr/include/unistd.h:779:46"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x1038b8828 <col:20> Inherited Implicit`: | ||||
| 		testNode{&NoThrowAttr{ | ||||
| 			Addr:       0x1038b8828, | ||||
| 			Pos:        NewPositionFromString("col:20"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 			Inherited:  true, | ||||
| 			Implicit:   true, | ||||
| 		}, | ||||
| 		0x1038b8828, | ||||
| 		NewPositionFromString("col:20"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,8 +5,9 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestNonNullAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fa1488273b0 <line:7:4, line:11:4> 1`: &NonNullAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fa1488273b0 <line:7:4, line:11:4> 1`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x7fa1488273b0, | ||||
| 			Pos:        NewPositionFromString("line:7:4, line:11:4"), | ||||
| 			Inherited:  false, | ||||
|  | @ -16,7 +17,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x2cce280 </sys/cdefs.h:286:44, /bits/mathcalls.h:115:69> 1`: &NonNullAttr{ | ||||
| 		0x7fa1488273b0, | ||||
| 		NewPositionFromString("line:7:4, line:11:4"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x2cce280 </sys/cdefs.h:286:44, /bits/mathcalls.h:115:69> 1`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x2cce280, | ||||
| 			Pos:        NewPositionFromString("/sys/cdefs.h:286:44, /bits/mathcalls.h:115:69"), | ||||
| 			Inherited:  false, | ||||
|  | @ -26,7 +32,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x201ede0 <line:145:79, col:93> 0`: &NonNullAttr{ | ||||
| 		0x2cce280, | ||||
| 		NewPositionFromString("/sys/cdefs.h:286:44, /bits/mathcalls.h:115:69"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x201ede0 <line:145:79, col:93> 0`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x201ede0, | ||||
| 			Pos:        NewPositionFromString("line:145:79, col:93"), | ||||
| 			Inherited:  false, | ||||
|  | @ -36,7 +47,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x1b89b20 <col:76, col:93> 2 3`: &NonNullAttr{ | ||||
| 		0x201ede0, | ||||
| 		NewPositionFromString("line:145:79, col:93"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x1b89b20 <col:76, col:93> 2 3`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x1b89b20, | ||||
| 			Pos:        NewPositionFromString("col:76, col:93"), | ||||
| 			Inherited:  false, | ||||
|  | @ -46,7 +62,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x55f0219e20d0 <line:717:22, col:42> 0 1 4`: &NonNullAttr{ | ||||
| 		0x1b89b20, | ||||
| 		NewPositionFromString("col:76, col:93"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x55f0219e20d0 <line:717:22, col:42> 0 1 4`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x55f0219e20d0, | ||||
| 			Pos:        NewPositionFromString("line:717:22, col:42"), | ||||
| 			Inherited:  false, | ||||
|  | @ -56,7 +77,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x248ea60 <line:155:26, col:49> 0 1 2 4`: &NonNullAttr{ | ||||
| 		0x55f0219e20d0, | ||||
| 		NewPositionFromString("line:717:22, col:42"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x248ea60 <line:155:26, col:49> 0 1 2 4`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x248ea60, | ||||
| 			Pos:        NewPositionFromString("line:155:26, col:49"), | ||||
| 			Inherited:  false, | ||||
|  | @ -66,7 +92,12 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          4, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		`0x39cf2b0 <col:53> Inherited 0 1`: &NonNullAttr{ | ||||
| 		0x248ea60, | ||||
| 		NewPositionFromString("line:155:26, col:49"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x39cf2b0 <col:53> Inherited 0 1`: | ||||
| 		testNode{&NonNullAttr{ | ||||
| 			Addr:       0x39cf2b0, | ||||
| 			Pos:        NewPositionFromString("col:53"), | ||||
| 			Inherited:  true, | ||||
|  | @ -76,6 +107,10 @@ func TestNonNullAttr(t *testing.T) { | |||
| 			D:          0, | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x39cf2b0, | ||||
| 		NewPositionFromString("col:53"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
|  | @ -5,12 +5,17 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestNotTailCalledAttr(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 		`0x7fc8fa094558 <col:107> `: &NotTailCalledAttr{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc8fa094558 <col:107> `: | ||||
| 		testNode{&NotTailCalledAttr{ | ||||
| 			Addr:       0x7fc8fa094558, | ||||
| 			Pos:        NewPositionFromString("col:107"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc8fa094558, | ||||
| 		NewPositionFromString("col:107"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										23
									
								
								ast/ns_consumed_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/ns_consumed_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNSConsumedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&NSConsumedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/ns_consumes_self_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/ns_consumes_self_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNSConsumesSelfAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&NSConsumesSelfAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										23
									
								
								ast/ns_error_domain_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/ns_error_domain_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNSErrorDomainAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&NSErrorDomainAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/ns_returns_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/ns_returns_retained_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestNSReturnsRetainedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&NSReturnsRetainedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										38
									
								
								ast/objc_bool_literal_expr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								ast/objc_bool_literal_expr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCBoolLiteralExpr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fcd0f9e7fe8 <col:13> 'BOOL':'signed char' __objc_yes`: | ||||
| 		testNode{&ObjCBoolLiteralExpr{ | ||||
| 			Addr:         0x7fcd0f9e7fe8, | ||||
| 			Pos:          NewPositionFromString("col:13"), | ||||
| 			Type:         "BOOL", | ||||
| 			Type2:        ":'signed char'", | ||||
| 			Attr:         " __objc_yes", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x7fcd0f9e7fe8, | ||||
| 		NewPositionFromString("col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 		`0x7fcd0f9ed000 <col:13> 'BOOL':'signed char' __objc_no`: | ||||
| 		testNode{&ObjCBoolLiteralExpr{ | ||||
| 			Addr:         0x7fcd0f9ed000, | ||||
| 			Pos:          NewPositionFromString("col:13"), | ||||
| 			Type:         "BOOL", | ||||
| 			Type2:        ":'signed char'", | ||||
| 			Attr:         " __objc_no", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x7fcd0f9ed000, | ||||
| 		NewPositionFromString("col:13"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										22
									
								
								ast/objc_boxable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/objc_boxable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCBoxableAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&ObjCBoxableAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										23
									
								
								ast/objc_bridge_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/objc_bridge_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCBridgeAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&ObjCBridgeAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										23
									
								
								ast/objc_bridge_mutable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/objc_bridge_mutable_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCBridgeMutableAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&ObjCBridgeMutableAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
							
								
								
									
										23
									
								
								ast/objc_bridge_related_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ast/objc_bridge_related_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCBridgeRelatedAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7> content`: | ||||
| 		testNode{&ObjCBridgeRelatedAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			Content:    " content", | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
|  | @ -5,15 +5,19 @@ import ( | |||
| ) | ||||
| 
 | ||||
| func TestObjCCategoryDecl(t *testing.T) { | ||||
| 	nodes := map[string]Node{ | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fdef0862430 <line:120:1, col:16> col:16 NSObject`: | ||||
| 		&ObjCCategoryDecl{ | ||||
| 		testNode{&ObjCCategoryDecl{ | ||||
| 			Addr:         0x7fdef0862430, | ||||
| 			Pos:          NewPositionFromString("line:120:1, col:16"), | ||||
| 			Position2:    "", | ||||
| 			Name:         "NSObject", | ||||
| 			ChildNodes:   []Node{}, | ||||
| 		}, | ||||
| 		0x7fdef0862430, | ||||
| 		NewPositionFromString("line:120:1, col:16"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
|  |  | |||
							
								
								
									
										22
									
								
								ast/objc_designated_initializer_attr_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ast/objc_designated_initializer_attr_test.go
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| package ast | ||||
| 
 | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
| 
 | ||||
| func TestObjCDesignatedInitializerAttr(t *testing.T) { | ||||
| 	nodes := map[string]testNode{ | ||||
| 		`0x7fc0a69091d1 <line:11:7, line:18:7>`: | ||||
| 		testNode{&ObjCDesignatedInitializerAttr{ | ||||
| 			Addr:       0x7fc0a69091d1, | ||||
| 			Pos:        NewPositionFromString("line:11:7, line:18:7"), | ||||
| 			ChildNodes: []Node{}, | ||||
| 		}, | ||||
| 		0x7fc0a69091d1, | ||||
| 		NewPositionFromString("line:11:7, line:18:7"), | ||||
| 		[]Node{}, | ||||
| 		}, | ||||
| 	} | ||||
| 
 | ||||
| 	runNodeTests(t, nodes) | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue
	
	Block a user