MCPcopy
hub / github.com/spf13/viper / TestAllKeys

Function TestAllKeys

viper_test.go:753–822  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

751}
752
753func TestAllKeys(t *testing.T) {
754 v := New()
755 initConfigs(v)
756
757 ks := []string{
758 "title",
759 "newkey",
760 "owner.organization",
761 "owner.dob",
762 "owner.bio",
763 "name",
764 "beard",
765 "ppu",
766 "batters.batter",
767 "hobbies",
768 "clothing.jacket",
769 "clothing.trousers",
770 "clothing.pants.size",
771 "age",
772 "hacker",
773 "id",
774 "type",
775 "eyes",
776 "title_dotenv",
777 "type_dotenv",
778 "name_dotenv",
779 }
780 dob, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
781 all := map[string]any{
782 "owner": map[string]any{
783 "organization": "MongoDB",
784 "bio": "MongoDB Chief Developer Advocate & Hacker at Large",
785 "dob": dob,
786 },
787 "title": "TOML Example",
788 "ppu": 0.55,
789 "eyes": "brown",
790 "clothing": map[string]any{
791 "trousers": "denim",
792 "jacket": "leather",
793 "pants": map[string]any{"size": "large"},
794 },
795 "id": "0001",
796 "batters": map[string]any{
797 "batter": []any{
798 map[string]any{"type": "Regular"},
799 map[string]any{"type": "Chocolate"},
800 map[string]any{"type": "Blueberry"},
801 map[string]any{"type": "Devil's Food"},
802 },
803 },
804 "hacker": true,
805 "beard": true,
806 "hobbies": []any{
807 "skateboarding",
808 "snowboarding",
809 "go",
810 },

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
initConfigsFunction · 0.85
AllKeysMethod · 0.80
AllSettingsMethod · 0.80

Tested by

no test coverage detected