You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by dp...@apache.org on 2018/08/22 17:10:33 UTC

[cordova-lib] 01/04: Add test for obscure HooksRunner bug (#653)

This is an automated email from the ASF dual-hosted git repository.

dpogue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-lib.git

commit 9deecf7150f25e1c39ec461f09408fdfbb750ab9
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Wed Aug 22 01:14:02 2018 +0200

    Add test for obscure HooksRunner bug (#653)
---
 integration-tests/HooksRunner.spec.js | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/integration-tests/HooksRunner.spec.js b/integration-tests/HooksRunner.spec.js
index 881f428..a65558f 100644
--- a/integration-tests/HooksRunner.spec.js
+++ b/integration-tests/HooksRunner.spec.js
@@ -389,4 +389,18 @@ describe('HooksRunner', function () {
             return hooksRunner.fire('CLEAN YOUR SHORTS GODDAMNIT LIKE A BIG BOY!', hookOptions);
         });
     });
+
+    describe('extractSheBangInterpreter', () => {
+        const rewire = require('rewire');
+        const HooksRunner = rewire('../src/hooks/HooksRunner');
+        const extractSheBangInterpreter = HooksRunner.__get__('extractSheBangInterpreter');
+
+        it('Test 025 : should not read uninitialized buffer contents', () => {
+            spyOn(require('fs'), 'readSync').and.callFake((fd, buf) => {
+                buf.write('#!/usr/bin/env XXX\n# foo');
+                return 0;
+            });
+            expect(extractSheBangInterpreter(__filename)).toBeFalsy();
+        });
+    });
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org