fn no_namespace_collisions() -> Result<(), anyhow::Error> {
        let mut holder = AnnotationHolder::new();

        // Add 2 annotations in different namespaces, with the same key.
        holder.update_annotations(
            vec![
                felement::Annotation {
                    key: make_annotation_key("namespace1", "id"),
                    value: make_annotation_text("_"),
                },
                felement::Annotation {
                    key: make_annotation_key("namespace2", "id"),
                    value: make_annotation_text("_"),
                },
            ],
            vec![],
        )?;
        let annotations = holder.get_annotations()?;
        assert_eq!(annotations.len(), 2);

        // Remove one, assert that the proper one is removed.
        holder.update_annotations(vec![], vec![make_annotation_key("namespace1", "id")])?;
        let annotations = holder.get_annotations()?;
        assert_eq!(annotations.len(), 1);
        assert_text_annotation_matches(&annotations[0], "namespace2", "id", "_");

        Ok(())
    }
// Verify that there is no collision between annotations with the same key, but different namespaces.
Verify that there is no collision between annotations with the same key, but different namespaces.
Verify that there is no collision between annotations with the same key but different namespaces .
fn no_namespace_collisions() -> Result<(), anyhow::Error> {
        let mut holder = AnnotationHolder::new();
        // Add 2 annotations in different namespaces, with the same key.
        holder.update_annotations(
            vec![
                felement::Annotation {
                    key: make_annotation_key("namespace1", "id"),
                    value: make_annotation_text("_"),
                },
                felement::Annotation {
                    key: make_annotation_key("namespace2", "id"),
                    value: make_annotation_text("_"),
                },
            ],
            vec![],
        )?;
        let annotations = holder.get_annotations()?;
        assert_eq!(annotations.len(), 2);
        // Remove one, assert that the proper one is removed.
        holder.update_annotations(vec![], vec![make_annotation_key("namespace1", "id")])?;
        let annotations = holder.get_annotations()?;
        assert_eq!(annotations.len(), 1);
        assert_text_annotation_matches(&annotations[0], "namespace2", "id", "_");
        Ok(())
    }
fn no_namespace_collisions ( ) -> Result < ( ) , anyhow :: Error > { let mut holder = AnnotationHolder :: new ( ) ; // Add 2 annotations in different namespaces, with the same key. holder . update_annotations ( vec ! [ felement Annotation { key make_annotation_key ( " " " " ) value make_annotation_text ( " " ) } felement Annotation { key make_annotation_key ( " " " " ) value make_annotation_text ( " " ) } ] , vec ! [ ] , ) ? ; let annotations = holder . get_annotations ( ) ? ; assert_eq ! ( annotations len ( ) 2 ) ; // Remove one, assert that the proper one is removed. holder . update_annotations ( vec ! [ ] , vec ! [ make_annotation_key ( " " " " ) ] ) ? ; let annotations = holder . get_annotations ( ) ? ; assert_eq ! ( annotations len ( ) 1 ) ; assert_text_annotation_matches ( & annotations [ 0 ] , " " , " " , " " ) ; Ok ( ( ) ) }
Verify that there is no collision between annotations with the same key, but different namespaces.
Verify that there is no collision between annotations with the same key but different namespaces .