cargo mutants: missed mutants in vortex-session

Offen Anfängerfreundlich
#12,633 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust
Bereich
testing-qa

Rechercherichtung

Lies vortex-session/src/registry.rs im Bereich von Id::index und untersuche anschließend die verknüpften Mutationsartefakte, um festzustellen, welche Verwendungen des zurückgegebenen Index bestehen bleiben. Füge Tests hinzu oder passe sie an, die fehlschlagen, wenn index() den falschen Wert zurückgibt, und führe cargo mutants -f vortex-session/src/registry.rs -F ':53:9:' erneut aus; fertig ist die Aufgabe, wenn beide gemeldeten Mutanten getötet werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

The nightly run at fdb9507c04e2939724aa39c298653a8ea3fd3b49 found 2 mutants in vortex-session that survive the tests. They are in code that changed during the last day.

Artifacts:

vortex-session/src/registry.rs:53:9

replace Id::index -> usize with 0

--- vortex-session/src/registry.rs
+++ replace Id::index -> usize with 0
@@ -45,17 +45,17 @@
 
     /// Returns the id's index in the global interner.
     ///
     /// Ids are interned densely from zero, so the index can address a `Vec` with one slot per id.
     /// An implementation detail of session registries, not part of the public API.
     #[doc(hidden)]
     #[inline]
     pub fn index(&self) -> usize {
-        self.0.into_usize()
+        0 /* ~ changed by cargo-mutants ~ */
     }
 
     /// Returns the interned string.
     pub fn as_str(&self) -> &str {
         let s = INTERNER.resolve(&self.0);
         // SAFETY: INTERNER is 'static and its arena is append-only, so resolved string
         // pointers are stable for the lifetime of the program.
         unsafe { &*(s as *const str) }
cargo mutants -f vortex-session/src/registry.rs -F ':53:9:'
vortex-session/src/registry.rs:53:9

replace Id::index -> usize with 1

--- vortex-session/src/registry.rs
+++ replace Id::index -> usize with 1
@@ -45,17 +45,17 @@
 
     /// Returns the id's index in the global interner.
     ///
     /// Ids are interned densely from zero, so the index can address a `Vec` with one slot per id.
     /// An implementation detail of session registries, not part of the public API.
     #[doc(hidden)]
     #[inline]
     pub fn index(&self) -> usize {
-        self.0.into_usize()
+        1 /* ~ changed by cargo-mutants ~ */
     }
 
     /// Returns the interned string.
     pub fn as_str(&self) -> &str {
         let s = INTERNER.resolve(&self.0);
         // SAFETY: INTERNER is 'static and its arena is append-only, so resolved string
         // pointers are stable for the lifetime of the program.
         unsafe { &*(s as *const str) }
cargo mutants -f vortex-session/src/registry.rs -F ':53:9:'
Vorherrschende Sprache
Rust
Sterne
3.2k
Forks
239
Ø Merge
1 T. 4 Std.
Gemergte PRs (30 T.)
684

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus vortex-data/vortex

Alle Issues in vortex-data/vortex

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.