Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please apply test patch #17

Open
bastien-roucaries opened this issue Oct 6, 2021 · 0 comments
Open

Please apply test patch #17

bastien-roucaries opened this issue Oct 6, 2021 · 0 comments

Comments

@bastien-roucaries
Copy link

commit 22eaee75e9d4da892b66ba941a993fae64e25a49
Author: Bastien Roucariès <[email protected]>
Date:   Wed Oct 6 09:58:19 2021 +0000

    Fix a Buffer warning
    
    Port tests to new buffer API
    
    Forwarded: not-needed

diff --git a/examples/add-chunk-test.js b/examples/add-chunk-test.js
index 409a20c..bdbd97f 100755
--- a/examples/add-chunk-test.js
+++ b/examples/add-chunk-test.js
@@ -7,16 +7,16 @@
   var buffer, remnant, result;
 
   function initBuffer() {
-    buffer = new Buffer(16);
+    buffer = Buffer.alloc(16);
 
-    buffer.addChunk(new Buffer("abcde"));
-    buffer.addChunk(new Buffer("fghij"));
+    buffer.addChunk(Buffer.from("abcde"));
+    buffer.addChunk(Buffer.from("fghij"));
   }
 
   function testExactSize() {
     initBuffer();
 
-    remnant = buffer.addChunk(new Buffer("klmnop"));
+    remnant = buffer.addChunk(Buffer.from("klmnop"));
 
     if ("abcdefghijklmnop" !== buffer.toString()) {
       console.log("FAIL: expected the letters a-p, but saw: ", buffer.toString());
@@ -39,7 +39,7 @@
     }
     */
 
-    result = buffer.addChunk(new Buffer("uvwxyz"));
+    result = buffer.addChunk(Buffer.from("uvwxyz"));
     if (false !== result) {
       console.log("FAIL: expected 'false', but saw: ", result);
     } else {
@@ -50,8 +50,8 @@
   function testTooBig() {
     initBuffer();
 
-    remnant = buffer.addChunk(new Buffer("klmno"));
-    remnant = buffer.addChunk(new Buffer("pqrst"));
+    remnant = buffer.addChunk(Buffer.from("klmno"));
+    remnant = buffer.addChunk(Buffer.from("pqrst"));
 
     if ("qrst" !== remnant.toString()) {
       console.log("FAIL: expected the letters 'qrst', but saw:", remnant.toString());
diff --git a/examples/require-test.js b/examples/require-test.js
index 819feee..a420955 100644
--- a/examples/require-test.js
+++ b/examples/require-test.js
@@ -7,4 +7,4 @@ console.log('Buffer.concat:');
 console.log(Buffer.concat);
 
 console.log('buffer.addChunk:');
-console.log((new Buffer(1).addChunk));
+console.log(Buffer.alloc(1).addChunk);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant