<commit_before>// Copyright 2013 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package router

import (
	"reflect"
	"testing"
)

func TestRegisterAndGet(t *testing.T) {
	var r Router
	Register("router", r)
	got, err := Get("router")
	if err != nil {
		t.Fatalf("Got unexpected error when getting router: %q", err)
	}
	if !reflect.DeepEqual(r, got) {
		t.Errorf("Get: Want %#v. Got %#v.", r, got)
	}
	_, err = Get("unknown-router")
	if err == nil {
		t.Errorf("Expected non-nil error when getting unknown router, got <nil>.")
	}
	expectedMessage := `Unknown router: "unknown-router".`
	if err.Error() != expectedMessage {
		t.Errorf("Expected error %q. Got %q.", expectedMessage, err.Error())
	}
}<commit_msg>router: using gocheck.<commit_after>// Copyright 2013 tsuru authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package router

import (
	"launchpad.net/gocheck"
	"testing"
)

func Test(t *testing.T) {
	gocheck.TestingT(t)
}

type S struct{}

var _ = gocheck.Suite(&S{})

func (s *S) TestRegisterAndGet(c *gocheck.C) {
	var r Router
	Register("router", r)
	got, err := Get("router")
	c.Assert(err, gocheck.IsNil)
	c.Assert(r, gocheck.DeepEquals, got)
	_, err = Get("unknown-router")
	c.Assert(err, gocheck.Not(gocheck.IsNil))
	expectedMessage := `Unknown router: "unknown-router".`
	c.Assert(expectedMessage, gocheck.Equals, err.Error())
}
{'fraction_non_alphanumeric': 0.14885245901639343, 'fraction_numerical': 0.005245901639344262, 'mean_word_length': 4.103678929765886, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3180037', 'n_tokens_mistral': 550, 'n_tokens_neox': 534, 'n_words': 164}