Browse Source

Test reference behavior of metrics in a Registry.

Richard Crowley 12 years ago
parent
commit
880a57cfbc
1 changed files with 12 additions and 0 deletions
  1. 12 0
      registry_test.go

+ 12 - 0
registry_test.go

@@ -35,6 +35,18 @@ func TestRegistry(t *testing.T) {
 	}
 }
 
+func TestRegistryGet(t *testing.T) {
+	r := NewRegistry()
+	r.Register("foo", NewCounter())
+	if count := r.Get("foo").(Counter).Count(); 0 != count {
+		t.Fatal(count)
+	}
+	r.Get("foo").(Counter).Inc(1)
+	if count := r.Get("foo").(Counter).Count(); 1 != count {
+		t.Fatal(count)
+	}
+}
+
 func TestRegistryGetOrRegister(t *testing.T) {
 	r := NewRegistry()