fn methods_docs_work()

in starlark/src/values/docs.rs [756:816]


    fn methods_docs_work() {
        let docs = SomeValue {}.documentation();
        let string_typ = Some(Type {
            raw_type: "String".to_owned(),
        });
        let expected_object = super::Object {
            docs: DocString::from_docstring(
                DocStringKind::Rust,
                "These are where the module docs go\n\nThis is what is passed to users for an object, so be careful\nnot to register two modules for a single object.",
            ),
            members: vec![
                (
                    "attr1".to_owned(),
                    super::Member::Property(super::Property {
                        docs: DocString::from_docstring(DocStringKind::Rust, "Docs for attr1"),
                        typ: string_typ.clone(),
                    }),
                ),
                (
                    "attr2".to_owned(),
                    super::Member::Property(super::Property {
                        docs: None,
                        typ: string_typ.clone(),
                    }),
                ),
                (
                    "func1".to_owned(),
                    super::Member::Function(super::Function {
                        docs: DocString::from_docstring(DocStringKind::Rust, "Docs for func1"),
                        params: vec![Param::Arg {
                            name: "foo".to_owned(),
                            docs: DocString::from_docstring(DocStringKind::Rust, "Docs for foo"),
                            typ: string_typ.clone(),
                            default_value: None,
                        }],
                        ret: Return {
                            docs: DocString::from_docstring(
                                DocStringKind::Rust,
                                "The string 'func1'",
                            ),
                            typ: string_typ.clone(),
                        },
                    }),
                ),
                (
                    "func2".to_owned(),
                    super::Member::Function(super::Function {
                        docs: None,
                        params: vec![],
                        ret: Return {
                            docs: None,
                            typ: string_typ,
                        },
                    }),
                ),
            ],
        };
        let expected = Some(DocItem::Object(expected_object));

        assert_eq!(expected, docs);
    }