Git Product home page Git Product logo

Comments (2)

jamesderlin avatar jamesderlin commented on April 28, 2024

Oh, the reason why it has the opposite problem is because of my fix for #142; the ReplayFile tests delegate to MemoryFile. I'm still not sure exactly why it's broken; I'm wondering if it's due to the fact that readAsLines is lossy and can't distinguish between a file with a terminating newline and a file without.

from file.dart.

jamesderlin avatar jamesderlin commented on April 28, 2024

I understand what's going on now.

In tests, RecordingFile.readAsLines delegates to MemoryFile.readAsLines and tries to save the returned List<String> by flattening it back into a String via List.join('\n'). Because of my fix for #142, the flattening process saves the file without a terminating newline even if one was originally present.

This can be fixed by making RecordingFile.readAsLines/readAsLinesSync always write a terminating newline. Of course, this creates the opposite problem where RecordingFile.readAsLines adds a terminating newline to the recorded file when there wasn't one originally. And indeed, such a change causes recording_test.dart's readAsLines tests to fail when the file content doesn't have a terminating newline.

However, I claim that it's the more correct thing to do. readAsLines makes sense only on text files, and the POSIX definition of a "text file" requires a terminating newline. I therefore claim that the file content in the affected tests should have terminating newlines in the first place.

from file.dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.