提交 934241c3 编写于 作者: 杜庆泉's avatar 杜庆泉

增加 date/number.tostring 部分测试示例

上级 10ac639b
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
> >
<!--meta-data--> <!--meta-data-->
<meta-data android:name="TencentMapSDK" android:value="您申请的腾讯定位App Key" /> <meta-data android:name="TencentMapSDK" android:value="您申请的腾讯定位App Key" />
<!--需要替换成开发者自己的包名-->
<activity android:name="uni.UNI70BE9D0.RootPackageActivity" <activity android:name="uni.UNI70BE9D0.RootPackageActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="uni.UNI70BE9D0.RootPackageActivity" /> <!--需要替换成开发者自己的包名-->
<category android:name="android.intent.category.DEFAULT" /> <action android:name="uni.UNI70BE9D0.RootPackageActivity" />
</intent-filter> <category android:name="android.intent.category.DEFAULT" />
</activity> </intent-filter>
</activity>
</application> </application>
</manifest> </manifest>
...@@ -194,8 +194,9 @@ class RootActivityStartListener extends OnClickListener{ ...@@ -194,8 +194,9 @@ class RootActivityStartListener extends OnClickListener{
} }
override onClick(v?: View):void{ override onClick(v?: View):void{
let intent = Intent("uni.UNI70BE9D0.RootPackageActivity") // 需要开发者替换成自己的包名,并且与AndroidManifest.xml 中保持一致
host.startActivity(intent) let intent = Intent("uni.UNI70BE9D0.RootPackageActivity")
host.startActivity(intent)
} }
} }
......
...@@ -9,7 +9,16 @@ export function testDate() : Result { ...@@ -9,7 +9,16 @@ export function testDate() : Result {
const secondsElapsed = Math.floor(millis / 1000) const secondsElapsed = Math.floor(millis / 1000)
expect(secondsElapsed).toEqual(2); expect(secondsElapsed).toEqual(2);
}, 2000) }, 2000)
}) })
test('new Date', () => {
let date1 = new Date('1992-02-02');
console.log("1111",date1.getTime())
expect(date1.getTime()).toEqual(696988800000);
let date2 = new Date('1992-2-02');
console.log("2222",date2.getTime())
expect(date2.getTime()).toEqual(696960000000);
})
test('valueOf', () => { test('valueOf', () => {
const date1 = new Date('December 17, 1995 03:24:00'); const date1 = new Date('December 17, 1995 03:24:00');
expect(date1.valueOf()).toEqual(819141840000); expect(date1.valueOf()).toEqual(819141840000);
...@@ -104,7 +113,8 @@ export function testDate() : Result { ...@@ -104,7 +113,8 @@ export function testDate() : Result {
expect(new Date(2016, 6, 6, 13, 59, 59, 999).getHours()).toEqual(13); expect(new Date(2016, 6, 6, 13, 59, 59, 999).getHours()).toEqual(13);
// subsequent millisecond // subsequent millisecond
expect(new Date(2016, 6, 6, 13, 59, 59, 1000).getHours()).toEqual(14); expect(new Date(2016, 6, 6, 13, 59, 59, 1000).getHours()).toEqual(14);
}) })
test('getMilliseconds', () => { test('getMilliseconds', () => {
const moonLanding = new Date('July 20, 69 00:20:18'); const moonLanding = new Date('July 20, 69 00:20:18');
moonLanding.setMilliseconds(123); moonLanding.setMilliseconds(123);
......
...@@ -84,6 +84,7 @@ export function testNumber() : Result { ...@@ -84,6 +84,7 @@ export function testNumber() : Result {
expect((6).toString(2)).toEqual("110"); expect((6).toString(2)).toEqual("110");
expect((254).toString(16)).toEqual("fe"); expect((254).toString(16)).toEqual("fe");
expect((-10).toString(2)).toEqual("-1010"); expect((-10).toString(2)).toEqual("-1010");
expect((-0xff).toString(2)).toEqual("-11111111"); expect((-0xff).toString(2)).toEqual("-11111111");
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册