Convert JSStackTraceTest to Kotlin (#37751)

Summary:
This PR converts JSStackTraceTest.java to Kotlin as requested in https://github.com/facebook/react-native/issues/37708.

## Changelog:
[INTERNAL] [CHANGED] - Convert JSStackTraceTest to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/37751

Test Plan:
Run ./gradlew :packages:react-native:ReactAndroid:test.
All tests should pass.

Reviewed By: mdvacca

Differential Revision: D46525516

Pulled By: cortinico

fbshipit-source-id: 880479fc4a38fcacb4a09820e9dbc469393a6cdb
This commit is contained in:
Aymane Missouri
2023-06-08 02:24:45 -07:00
committed by Facebook GitHub Bot
parent 767b97c4da
commit 3540d88809
@@ -5,18 +5,18 @@
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.util;
package com.facebook.react.util
import com.facebook.react.bridge.JavaOnlyArray;
import com.facebook.react.bridge.JavaOnlyMap;
import org.junit.Assert;
import org.junit.Test;
import com.facebook.react.bridge.JavaOnlyArray
import com.facebook.react.bridge.JavaOnlyMap
import org.junit.Assert
import org.junit.Test
public class JSStackTraceTest {
class JSStackTraceTest {
@Test
public void testSymbolication() {
JavaOnlyArray values =
fun testSymbolication() {
val values =
JavaOnlyArray.of(
JavaOnlyMap.of(
"methodName",
@@ -80,17 +80,21 @@ public class JSStackTraceTest {
"lineNumber",
10,
"file",
"address at seg-3_198.js"));
String message = JSStackTrace.format("Error", values);
"address at seg-3_198.js"))
val message = JSStackTrace.format("Error", values)
Assert.assertEquals(
message,
"Error, stack:\n"
+ "method_from_bundle@7:11\n"
+ "method_from_ram_bundle@199.js:18:13\n"
+ "method_from_ram_bundle_with_address@199.js:18:13\n"
+ "method_from_segment@seg-1.js:9:18\n"
+ "method_from_segment_with_address@seg-1.js:9:18\n"
+ "method_from_ram_segment@seg-3_198.js:10:20\n"
+ "method_from_ram_segment_with_address@seg-3_198.js:10:20\n");
"""
Error, stack:
method_from_bundle@7:11
method_from_ram_bundle@199.js:18:13
method_from_ram_bundle_with_address@199.js:18:13
method_from_segment@seg-1.js:9:18
method_from_segment_with_address@seg-1.js:9:18
method_from_ram_segment@seg-3_198.js:10:20
method_from_ram_segment_with_address@seg-3_198.js:10:20
"""
.trimIndent())
}
}