fix #16978 unittest js foreign exception (#16998)

* fix #16978 unittest js foreign exception
This commit is contained in:
Timothee Cour 2021-02-13 00:51:46 -08:00 • committed by GitHub
commit fff5819ee7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 3 deletions

View file

@ -0,0 +1,16 @@
discard """
exitcode: 1
outputsub: '''
Unhandled exception: Cannot read property 'charCodeAt' of null [<foreign exception>]
[FAILED] Bad test
'''
matrix: "-d:nodejs"
targets: "js"
joinable: false
"""
# bug #16978
import unittest
test "Bad test":
var x: cstring = nil
let y = x[0]