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 4423cf4532606467eff8057695fa34883a56289a..985a080afbb30974aa6ab8d8f64a316f066aa715 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.