From 8ce105c94c361a2ed1169f1f8dce005bf137e6eb Mon Sep 17 00:00:00 2001 From: zWX1234017 Date: Wed, 19 Jul 2023 09:43:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0buffer=E6=A8=A1=E5=9D=97from?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3XTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gitee.com/openharmony/xts_acts/issues/I7M6T3 Signed-off-by: zWX1234017 --- .../src/main/js/test/Buffer.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js b/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js index 4423cf453..985a080af 100644 --- a/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js +++ b/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js @@ -1912,6 +1912,18 @@ describe('BufferTest', function () { expect(str).assertEqual("this is a test"); }); + /** + * @tc.name: testfrom0269 + * @tc.desc: Create a new buffer containing a newline character string. Creating using base64 encoding + * For example: buffer.from(string, encoding); + */ + it("testfrom0269", 0, function () { + const str = `MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC/OgIQLaulKklB\npZltSaWwM3Cnzcmvh+LoqYFYjCePUxnoJRDusFqy4sjwBx9fn/XSxxJ9A0KxMtXa\nr7YFjwQo3FsIjLZ3+8wS+Kydcg==`; + const buf = buffer.from(str, 'base64'); + let ref = buf.readInt8(buf.length - 1); + expect(ref).assertEqual(114); + }); + /** * @tc.name: testBlobConstructor0270 * @tc.desc: Creates a new Blob object containing a concatenation of the given sources. -- GitLab