-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the API for TypeNameSet (#1607)
* Remove set returns from TypeNameSet and test * Code gardening * Fix bug in TypeMatcher
- Loading branch information
1 parent
76d4bf8
commit 3b1d6ce
Showing
15 changed files
with
111 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
package astmodel | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var ( | ||
oneTypeName = MakeTypeName(GenRuntimeReference, "One") | ||
twoTypeName = MakeTypeName(GenRuntimeReference, "Two") | ||
) | ||
|
||
/* | ||
* Empty Set tests | ||
*/ | ||
|
||
func Test_TypeNameSet_WhenEmpty_HasLengthZero(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
emptySet := NewTypeNameSet() | ||
g.Expect(len(emptySet)).To(Equal(0)) | ||
} | ||
|
||
/* | ||
* Add() Tests | ||
*/ | ||
|
||
func Test_TypeNameSet_AfterAddingFirstItem_ContainsItem(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
set := NewTypeNameSet() | ||
set.Add(oneTypeName) | ||
g.Expect(set.Contains(oneTypeName)).To(BeTrue()) | ||
} | ||
|
||
func Test_TypeNameSet_AfterAddingSecondItem_ContainsItem(t *testing.T) { | ||
g := NewGomegaWithT(t) | ||
set := NewTypeNameSet() | ||
set.Add(oneTypeName) | ||
set.Add(twoTypeName) | ||
g.Expect(set.Contains(twoTypeName)).To(BeTrue()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters