var text = use('text'); var blob = use('blob'); var utf8 = use('utf8'); // Test blob to text conversion var test_string = "Hello, δΈ–η•Œ! 🌍"; var encoded_blob = utf8.encode(test_string); var decoded_text = text(encoded_blob); log.console("Blob to text test:"); log.console(" Original:", test_string); log.console(" Decoded:", decoded_text); log.console(" Match:", test_string === decoded_text ? "PASS" : "FAIL"); // Test array of codepoints conversion var codepoints = [72, 101, 108, 108, 111, 44, 32, 19990, 30028, 33, 32, 127757]; var from_codepoints = text(codepoints); log.console("\nCodepoints to text test:"); log.console(" From codepoints:", from_codepoints); log.console(" Match:", from_codepoints === test_string ? "PASS" : "FAIL"); // Test array with separator var words = ["Hello", "world", "from", "text"]; var joined = text(words, " "); log.console("\nArray with separator test:"); log.console(" Joined:", joined); log.console(" Expected: Hello world from text"); log.console(" Match:", joined === "Hello world from text" ? "PASS" : "FAIL"); // Test mixed array with codepoints var mixed = [72, "ello", 32, "world"]; var mixed_result = text(mixed, ""); log.console("\nMixed array test:"); log.console(" Result:", mixed_result); log.console(" Expected: Hello world"); log.console(" Match:", mixed_result === "Hello world" ? "PASS" : "FAIL"); // Test blob encoding formats still work var test_data = utf8.encode("ABC"); log.console("\nBlob format tests:"); log.console(" Hex:", text(test_data, "h")); log.console(" Binary:", text(test_data, "b")); log.console(" Octal:", text(test_data, "o")); log.console("\nAll tests completed!"); $_.stop();