iterators3 tests dont check if errors are returned correctly
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- testing-qa
Direzione di ricerca
Inizia da exercises/18_iterators/iterators3.rs e dai test esistenti; confronta le relative asserzioni con la soluzione di filtraggio descritta nell’issue. Aggiorna l’esercizio o i suoi input di test in modo che un’implementazione che scarta le varianti Err fallisca, e verifica che il comportamento previsto di Result sia coperto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm currently doing rustlings and struggled with iterators3 and searched a solution, which i thought i found here.
It implements one of the functions to edit like this:
fn result_with_list() -> Result<Vec<i64>, DivisionError> {
let numbers = vec![27, 297, 38502, 81];
let division_results = numbers.into_iter().map(|n| divide(n, 27));
division_results.filter(|x| x.is_ok()).collect()
}
which compiles and passes the implemented test but this didn't make any sense to me, as this can never return a correct Err variant, at "best" this would return and empty Vec<i64>, if every division returns an Err variant, which is, as far as i understand, not the intended solution.
To remedy this, I would suggest adding test cases to cover this wrong solution, but since the functions that get tested here don't take any parameters, but instead have hard-coded values inside them, this would require changing their signature and passing in the vector of numbers to be divided.
I'm new to rust, so please let me know if this isn't a real issue.
If this is indeed a real issue, I'm happy to suggest an updated version of this exercise.
- Lingua principale
- Rust
- Stelle
- 64.8k
- Fork
- 11.3k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-lang/rustlings
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
A-exercises C-enhancement P-low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Proposal: German (Deutsch) translation for Community ExercisesForse di nuovo libera @mo8it l’ha presa 82 giorni fa e non c’è nessuna pull request aperta. Aperta
rust-lang/rustlings#2445 · 4 commenti · 2 reazioni · 1 assegnatario ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di rust-lang/rustlings
Issue simili
-
fix: production-image scan fails on base-image CVEs (libzstd, libssl)Forse già presa @Kravalg l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
VilnaCRM-Org/notification-service#41 ·
I maintainer di solito rispondono entro 4 giorni
-
Thai project names become 'project', 'project-2'… (slug keeps ASCII only)Forse già presa @mastel2 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
storytold/craft-anything#2538 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
compiler-explorer/compiler-explorer#9738 ·
I maintainer di solito rispondono entro 2 giorni
-
area: runtime enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
hffgzktbcc-blip/ounce-core#663 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
zellij-org/zellij#6026 ·
I maintainer di solito rispondono entro 1 giorno