File tree Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Expand file tree Collapse file tree 3 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ packages:
75
75
path: ".."
76
76
relative: true
77
77
source: path
78
- version: "0.4.0+1 "
78
+ version: "0.4.0+2 "
79
79
flutter_test:
80
80
dependency: "direct dev"
81
81
description: flutter
Original file line number Diff line number Diff line change @@ -115,17 +115,19 @@ abstract class JSPropertyEnum extends Opaque {}
115
115
116
116
final DynamicLibrary _qjsLib = Platform .environment['FLUTTER_TEST' ] == 'true'
117
117
? (Platform .isWindows
118
- ? DynamicLibrary .open ('test/build/Debug/ffiquickjs .dll' )
118
+ ? DynamicLibrary .open ('quickjs_c_bridge .dll' )
119
119
: Platform .isMacOS
120
- ? DynamicLibrary .open ('test/build/libffiquickjs.dylib' )
121
- : DynamicLibrary .open ('test/build/libffiquickjs.so' ))
120
+ ? DynamicLibrary .process ()
121
+ : DynamicLibrary .open (Platform .environment['LIBQUICKJSC_PATH' ] ??
122
+ 'libquickjs_c_bridge_plugin.so' ))
122
123
: (Platform .isWindows
123
124
? DynamicLibrary .open ('quickjs_c_bridge.dll' )
124
125
: (Platform .isLinux
125
- ? DynamicLibrary .open (Platform .environment['LIBQUICKJSC_PATH' ] ?? 'libquickjs_c_bridge_plugin.so' )
126
- : (Platform .isAndroid
127
- ? DynamicLibrary .open ('libfastdev_quickjs_runtime.so' )
128
- : DynamicLibrary .process ())));
126
+ ? DynamicLibrary .open (Platform .environment['LIBQUICKJSC_PATH' ] ??
127
+ 'libquickjs_c_bridge_plugin.so' )
128
+ : (Platform .isAndroid
129
+ ? DynamicLibrary .open ('libfastdev_quickjs_runtime.so' )
130
+ : DynamicLibrary .process ())));
129
131
130
132
/// DLLEXPORT JSValue *jsThrow(JSContext *ctx, JSValue *obj)
131
133
final Pointer <JSValue > Function (
Original file line number Diff line number Diff line change @@ -7,13 +7,24 @@ void main() {
7
7
8
8
TestWidgetsFlutterBinding .ensureInitialized ();
9
9
10
+ late JavascriptRuntime jsRuntime;
11
+
10
12
setUp (() {
11
- channel.setMockMethodCallHandler ((MethodCall methodCall) async {
12
- return '42' ;
13
- });
13
+ jsRuntime = getJavascriptRuntime ();
14
14
});
15
15
16
16
tearDown (() {
17
- channel.setMockMethodCallHandler (null );
17
+ try {
18
+ jsRuntime.dispose ();
19
+ } on Error catch (_) {}
20
+ });
21
+
22
+ test ('evaluate javascript' , () {
23
+ final result = jsRuntime.evaluate ('Math.pow(5,3)' );
24
+ print ('${result .rawResult }, ${result .stringResult }' );
25
+ print (
26
+ '${result .rawResult .runtimeType }, ${result .stringResult .runtimeType }' );
27
+ expect (result.rawResult, equals (125 ));
28
+ expect (result.stringResult, equals ('125' ));
18
29
});
19
30
}
You can’t perform that action at this time.
0 commit comments