Limiting history entries #ag6 Question

I’m stuck on Stage #ag6

The question is about the tests being run. The first part of the tests where it tests my code for history size works successfully

[tester::#AG6] Running tests for Stage #AG6 (History - Limiting history entries)

this completes successfully. The next portion fails.

[tester::#YF5] Running tests for Stage #YF5 (History - Listing history)

Should this history reset between these run? The tests are failing below.

[tester::#YF5] Running tests for Stage #YF5 (History - Listing history)
[tester::#YF5] Running ./your_program.sh
[your-program] $ echo banana blueberry
[your-program] banana blueberry
[tester::#YF5] ✓ Command executed successfully
[your-program] $ echo pineapple blueberry
[your-program] pineapple blueberry
[tester::#YF5] ✓ Command executed successfully
[your-program] $ echo banana pineapple
[your-program] banana pineapple
[tester::#YF5] ✓ Command executed successfully
[your-program] $ history
[your-program] 1 echo apple grape
[tester::#YF5] ^ Line does not match expected value.
[tester::#YF5] Expected: " 1 echo banana blueberry"
[tester::#YF5] Received: " 1 echo apple grape"

the returned data is based on the entire history, not just the recent history. Do I need to reset the history at a certain point?

Hey @xsynch, looks like you’ve implemented some form of history persistence. History persistence should respect the HISTFILE environment variable so each test run uses the expected history file.

For now, I’d recommend keeping history in-memory only for this extension, and waiting until the upcoming history persistence extension before adding file-based behavior.

That should prevent history from earlier test runs leaking into later stages. Let me know if anything’s unclear

Ah, totally understand. I was getting ahead of myself.